0

I am trying to hide the Place Order Button on my WooCommerce Site, but the behavior seems to be overridden by some other script because the button would hide and then it would reappear.

I am using the storefront 1.5 theme and Wordpress 4.3

JS Loading Code :

add_action('wp_enqueue_scripts', 'order_summary_script', 9999); //last script to load
function order_summary_script() {
    wp_enqueue_script('order-summary', get_bloginfo('stylesheet_directory') . '/assets/js/order-summary.js', array('jquery'), '1.0.0', true);
}

Hiding Code:

jQuery( document ).ready(function($) {
    //hide place order button on checkout page
    $('input[name=woocommerce_checkout_place_order]').hide();
});

enter image description here

Update:

Even if I added the script to the footer per Dev Danidhariya suggestion ( which means it's the last script ) it still doesn't fix it. Wordpress Codex mention below:

JavaScript cannot be added to post content without a special WordPress Plugin that removes the filters that prevent unwanted code within the post content area, for the protection of the user.

Could this be the problem?

4

1 回答 1

0

在您的活动主题Footer.php中添加此代码

<script>
    jQuery( document ).ready(function($) {
        //hide place order button on checkout page
        $('input[name=woocommerce_checkout_place_order]').hide();
    });
</script>
于 2015-09-07T11:00:49.990 回答