For Developers
Shortcodes
Section titled “Shortcodes”Free Shipping Notice
Section titled “Free Shipping Notice”[wpify_woo_free_shipping_notice]Displays the complete notice including the progress bar and text.
Remaining Amount Only
Section titled “Remaining Amount Only”[wpify_woo_amount_for_free_shipping]Displays only the formatted remaining amount (e.g., 500 Kč).
Filters
Section titled “Filters”wpify_woo_free_shipping_render_notice
Section titled “wpify_woo_free_shipping_render_notice”Allows conditionally hiding the notice.
apply_filters( 'wpify_woo_free_shipping_render_notice', bool $render );Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
$render | bool | Display notice (default: true) |
Example: Hide for Logged-in Users
Section titled “Example: Hide for Logged-in Users”add_filter( 'wpify_woo_free_shipping_render_notice', function( $render ) { if ( is_user_logged_in() ) { return false; } return $render;} );wpify_woo_free_shipping_amount
Section titled “wpify_woo_free_shipping_amount”Modifies the free shipping limit value.
apply_filters( 'wpify_woo_free_shipping_amount', float $amount, object $module );Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
$amount | float | Free shipping amount |
$module | object | FreeShippingNoticeModule instance |
Example: Different Limits by Country
Section titled “Example: Different Limits by Country”add_filter( 'wpify_woo_free_shipping_amount', function( $amount, $module ) { $country = WC()->customer->get_shipping_country() ?? WC()->customer->get_billing_country();
if ( $country === 'SK' ) { return 50; // 50 EUR for Slovakia }
return $amount; // Default for other countries}, 10, 2 );wpify_woo_free_shipping_amount_for_free_shipping
Section titled “wpify_woo_free_shipping_amount_for_free_shipping”Modifies the remaining amount until free shipping.
apply_filters( 'wpify_woo_free_shipping_amount_for_free_shipping', float $remaining );Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
$remaining | float | Remaining amount (can be negative) |
wpify_woo_free_shipping_is_free
Section titled “wpify_woo_free_shipping_is_free”Determines whether shipping is free.
apply_filters( 'wpify_woo_free_shipping_is_free', bool $is_free );Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
$is_free | bool | Shipping is free (default: $remaining <= 0) |
Example: Free Shipping for VIP Customers
Section titled “Example: Free Shipping for VIP Customers”add_filter( 'wpify_woo_free_shipping_is_free', function( $is_free ) { $user = wp_get_current_user(); if ( in_array( 'vip_customer', $user->roles ) ) { return true; } return $is_free;} );wpify_woo_free_shipping_notice_custom_html
Section titled “wpify_woo_free_shipping_notice_custom_html”Replaces the default notice HTML with your own markup.
apply_filters( 'wpify_woo_free_shipping_notice_custom_html', string|null $custom_html, array $context, object $module );Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
$custom_html | string|null | Return a string to override the default template (default: null) |
$context | array | Render context — see below |
$module | object | FreeShippingNoticeModule instance |
Context keys
Section titled “Context keys”| Key | Type | Description |
|---|---|---|
cart_amount | float | Current cart amount |
free_shipping_amount | float | Free shipping threshold |
amount_for_free_shipping | float | Remaining amount until free shipping |
amount_for_free_shipping_html | string | Formatted remaining amount (via wc_price()) |
percentage_for_free_shipping | int | Progress percentage (capped at 100) |
free_shipping_message | string | Resolved message (regular or confirmation) |
is_free_shipping | bool | Whether shipping is currently free |
⚠️ The returned string is echoed without escaping. Escape any data coming from
$contextyourself (esc_html(),wp_kses_post(), …).
Example: Custom HTML template
Section titled “Example: Custom HTML template”add_filter( 'wpify_woo_free_shipping_notice_custom_html', function( $html, $context ) { if ( $context['is_free_shipping'] ) { return '<div class="my-notice my-notice--success">' . esc_html( $context['free_shipping_message'] ) . '</div>'; }
return sprintf( '<div class="my-notice"><strong>%s</strong> %s</div>', esc_html( $context['free_shipping_message'] ), $context['amount_for_free_shipping_html'] );}, 10, 2 );CSS Classes
Section titled “CSS Classes”| Class | Element |
|---|---|
.wpify-woo-free-shipping-notice__wrapper | Outer wrapper (used for AJAX fragments) |
.wpify-woo-free-shipping-notice | Main notice container |
.progress | Progress bar container |
.progress-value | Filled part of the progress bar |
Custom Styling Example
Section titled “Custom Styling Example”.wpify-woo-free-shipping-notice { border-radius: 8px; margin-bottom: 20px;}
.wpify-woo-free-shipping-notice .progress { height: 15px; margin-top: 10px;}
.wpify-woo-free-shipping-notice .progress-value { background: linear-gradient(90deg, #4CAF50, #8BC34A);}AJAX Updates
Section titled “AJAX Updates”The notice automatically updates when:
- Adding a product to cart
- Changing quantity in cart
- Removing a product from cart
- Updating checkout
The module uses WooCommerce fragments (woocommerce_add_to_cart_fragments and woocommerce_update_order_review_fragments).
Compatibility
Section titled “Compatibility”Woo Currency Switcher
Section titled “Woo Currency Switcher”The module is compatible with the Woo Currency Switcher plugin. The free shipping limit is automatically recalculated using the woocs_exchange_value filter.
Where to Add Code
Section titled “Where to Add Code”You can add custom functions to:
- The
functions.phpfile in your child theme - The Code Snippets plugin