disable form tip and remove previously added tip on shipping method change
-
Hello there! Great plugin!
Quick question! I am using the following code to disable the tip form on all shipping methods except free shipping:
add_filter( 'wc_order_tip_display_form', 'courier_tips_custom_display', 10, 1 );
function courier_tips_custom_display( $display ) {
// Get the chosen shipping methods
$chosen_methods = WC()->session->get('chosen_shipping_methods');
if (!in_array('free_shipping:1', $chosen_methods)) {
$display = false;
}
return $display;
}If I do a hard refresh every time I change shipping method, this seems to be working. But, are there any filters or actions I could add to make this automatically disable or enable the form upon shipping methods updates without having to refresh the checkout page? Also, if the user changes from free shipping to let’s say local pick up or any other available shipping method options, is there a filter to completely remove the previsouly added tip?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.