This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter( | |
| "generate_svg_icon_element", | |
| function ($output, $icon) { | |
| switch ($icon) { | |
| case "menu-bars": | |
| $output = | |
| '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"/></svg>'; | |
| break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Integrate WPF Return into Gravity Forms Login Shortcode | |
| function zf_check_for_wpf_return_cookie_on_login( $login_redirect, $sign_on ) { | |
| // Check for WPF Return Cookie and ensure it's a valid post ID | |
| if ( isset( $_COOKIE["wpf_return_to"] ) && is_numeric( $_COOKIE["wpf_return_to"] ) ) { | |
| // Get Permalink for the specified post ID | |
| $return_url = get_permalink( (int) $_COOKIE["wpf_return_to"] ); | |
| // Set Redirect to the sanitized URL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Hide Free Cases if Subscription in Cart | |
| function hideWidgetIfSubscription() { | |
| let subscription_exists = false; | |
| const rebuy_widget = window.Rebuy.widgets.find(widget => widget.id === "161420"); | |
| const cart_items = Rebuy.SmartCart.items(); | |
| // Use some to check for subscription existence | |
| subscription_exists = cart_items.some(item => item.product.subscription === true); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get Active Tabs Object | |
| const getActiveTabs = () => { | |
| const tabObject = {}; // Initialize an empty object | |
| const wooTabsContainer = document.querySelector('.wc-tabs-wrapper'); | |
| // Check if the container exists | |
| if (!wooTabsContainer) { | |
| console.error('Tabs container not found.'); | |
| return tabObject; // Return an empty object if not found |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function zf_block_and_log_checkout_api_requests() { | |
| $current_url = $_SERVER['REQUEST_URI']; | |
| $msg_to_log = 'Checkout API Blocked: ' . $_SERVER['REMOTE_ADDR']; | |
| if ( strpos( $current_url, '/wp-json/wc/store/checkout' ) !== false ) { | |
| error_log( $msg_to_log , 0); | |
| wp_redirect( home_url() ); | |
| exit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function zf_get_line_item_returned_quantity( $item, $order ) { | |
| $returned_quantity = 0; | |
| foreach ($order->get_refunds() as $refund) { | |
| foreach ($refund->get_items() as $refund_item) { | |
| if ($refund_item->get_product_id() == $item->get_product_id()) { | |
| $returned_quantity += $refund_item->get_quantity(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function zf_get_recent_subscription_order_items( $id ){ | |
| if ( is_nan( $id ) ) { | |
| return ''; | |
| } | |
| $subscription = new WC_Subscription( $id ); | |
| $related_orders = $subscription->get_related_orders(); | |
| $recent_order_id = current( $related_orders ); | |
| $recent_order = wc_get_order( $recent_order_id ); |
NewerOlder