Untitled

mail@pastecode.io avatar
unknown
plain_text
21 days ago
746 B
1
Indexable
Never
/**
 * Display [add-slm-map-iframe] shortcode above checkout form
 * when specific shipping method is selected.
 */
function display_slm_map_above_checkout_form() {
    // Check if Skroutz Point shipping method is selected
    $chosen_methods = WC()->session->get('chosen_shipping_methods');
    $chosen_shipping_method = $chosen_methods[0];

    // Define your shipping method identifier here
    $target_shipping_method = 'slm_delivery_service:23'; // Change this to match your shipping method value

    if ($chosen_shipping_method === $target_shipping_method) {
        echo do_shortcode('[add-slm-map-iframe]');
        
    }
}
add_action('woocommerce_review_order_before_payment', 'display_slm_map_above_checkout_form');
Leave a Comment