Replacing sales booster free shipping (need hook)

This topic has 6 replies, 2 voices, and was last updated 9 months ago ago by Rose Tyler

  • Avatar: Nancy
    Nancy
    Participant
    August 7, 2023 at 14:05

    Hello,
    I would like to replace the sales booster free shipping script with my own snippet. Could you tell me the hook I should use for this?

    I added a screenshot
    https://prnt.sc/oGqgkkPQiAdH

    Thanks in advance!
    Nancy

    5 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    August 7, 2023 at 14:11

    Hello, Nancy,

    Thank you for contacting us and for using XStore.

    We kindly request you to peruse the next article – https://xstore.helpscoutdocs.com/article/134-progress-bar

    We trust that the information provided will be of significant assistance to you.

    Kind Regards,
    8theme team

    Avatar: Nancy
    Nancy
    Participant
    August 7, 2023 at 14:14

    The version you have doesn’t support multiple countries.

    I have made this:

    `add_action(‘init’, ‘set_country_based_on_parameter’);

    function set_country_based_on_parameter() {
    if (isset($_GET[‘set_country’])) {
    $country = wc_clean($_GET[‘set_country’]); // Sanitize user input

    if ($country == ‘BE’ || $country == ‘NL’) {
    WC()->customer->set_shipping_country($country);
    WC()->customer->set_billing_country($country);

    if($country == ‘BE’){
    $country_name = ‘Belgium’;
    }else{
    $country_name = ‘Netherlands’;
    }

    wc_add_notice(‘Your shipping country has been set to ‘.$country_name.’. You can change it in your account settings.’, ‘success’);
    }
    }
    }
    add_action( ‘woocommerce_before_cart’, ‘show_shipping_message_based_on_country’ );

    function show_shipping_message_based_on_country() {
    $cart_total = round(WC()->cart->get_subtotal(),2);
    $shipping_country = WC()->customer->get_shipping_country();

    if ($shipping_country === ‘NL’) { // Netherlands
    $free_shipping_limit = 25;
    $switch_country_code = ‘BE’;
    $switch_country_name = ‘België’;
    } elseif ($shipping_country === ‘BE’) { // Belgium
    $free_shipping_limit = 60;
    $switch_country_code = ‘NL’;
    $switch_country_name = ‘Nederland’;
    } else { // Default case for other countries (optional)
    $free_shipping_limit = 50;
    $switch_country_code = ‘BE’;
    $switch_country_name = ‘België’;
    }

    if ($cart_total < $free_shipping_limit) { $remaining = $free_shipping_limit - $cart_total; $link = add_query_arg('set_country', $switch_country_code, wc_get_cart_url()); wc_print_notice( sprintf( 'Nog €%s voor gratis verzending! Ben je in %s? Klik hier om je land te veranderen.’, $remaining, $switch_country_name, $link ), ‘notice’ );
    }
    }’

    This will support 2 countries (Netherlands and Belgium).

    I want to replace your version with this, but I think I need the right hook.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    August 7, 2023 at 15:32

    Hello, Nancy,

    We appreciate your prompt response.

    1/ We have filter for the amount that was used as an example here → https://www.8theme.com/topic/shopping-cart-icon-amount-is-not-updated/#post-361681
    2/ Filter name is → ‘et_progress_bar_amount’
    3/ In case you would like to explore the code for your needs you can check the next file → et-core-plugin/app/models/customizer/functions.php and etheme_woocomerce_mini_cart_footer() (function name)

    Please note that additional customization in files falls beyond the purview of our basic support scope.

    If you would like to pursue paid customization services, we recommend submitting a customization request to the Codeable team via their website: https://www.codeable.io/?ref=qGTdX

    Should you have any other inquiries or issues, we encourage you to contact us without hesitation. Our support team is consistently accessible to provide assistance through our support forum – https://themeforest.net/page/item_support_policy

    Kind Regards,
    8theme team

    Avatar: Nancy
    Nancy
    Participant
    August 7, 2023 at 15:36

    Yes et_progress_bar_amount was the one I needed! Thank you!

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    August 7, 2023 at 15:38

    Hello, Nancy,

    Great! You’re welcome!

    Kind Regards,
    8theme team

  • Viewing 6 results - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.