This topic has 6 replies, 2 voices, and was last updated 1 years, 3 months ago ago by Rose Tyler
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
Hello, Nancy,
Thank you for contacting us and for using XStore.
We kindly request you to peruse the next article – https://www.8theme.com/documentation/xstore/xstore-features/progress-bar/
We trust that the information provided will be of significant assistance to you.
Kind Regards,
8theme team
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.
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
Yes et_progress_bar_amount was the one I needed! Thank you!
Hello, Nancy,
Great! You’re welcome!
Kind Regards,
8theme team
You must be logged in to reply to this topic.Log in/Sign up