Category: Woocommerce Hooks

  • Woocommerce Hook  Change Product Price Tags

    Woocommerce Hook Change Product Price Tags

    Hello, welcome to therichpost.com. In this post, I will tell you Woocommerce Hook Change Product Price Tags. WordPress is the best cms and Woocommerce is the best Ecommerce plugin. WordPress hooks(add_action, add_filter) give us the power to edit or change the code without interruption into the files and this is the best thing about wordpress. Now I am going to tell you how the hooks work.

    Image first without hook:

    Image first with hook:

    Here is the working code for Woocommerce Hook Change Product Price Tags and you need to add this code into your theme’s functions.php file.

    add_action(‘woocommerce_product_options_general_product_data’, ‘woo_add_custom_general_fields’);

    function woo_add_custom_general_fields()
    {
    echo “<script type=’text/javascript’>
    jQuery(document).ready(function() {
    jQuery(‘._regular_price_field label’).html(‘RRP($)’);
    jQuery(‘._sale_price_field label’).html(‘Selling Price($)’);
    });
    </script>”;
    }

    There are so many hooks in woocommerce and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

  • WOOCOMMERCE – CART: REDIRECT EMPTY CART TO EMPTY CART PAGE

    WOOCOMMERCE – CART: REDIRECT EMPTY CART TO EMPTY CART PAGE

    Hello, welcome to therichpost.com. In this post, I will tell you How to WOOCOMMERCE – CART: REDIRECT EMPTY CART TO EMPTY CART PAGE? WordPress is the best cms and Woocommerce is the best Ecommerce plugin. WordPress hooks(add_action, add_filter) give us the power to edit or change the code without interruption into the files and this is the best thing about wordpress. Now I am going to tell you how the hooks work.

    In this post will will do, if woocommerce cart page is empty or having no product then it will be redirect to empty cart page.

    Here is the working code for WOOCOMMERCE – CART: REDIRECT EMPTY CART TO EMPTY CART PAGE and you need to add this code into your theme’s functions.php file.

    add_action(“template_redirect”, ‘redirection_function’);
    function redirection_function()
    {
    global $woocommerce, $woocommerce_errors;
    if (is_cart() && sizeof($woocommerce->cart->cart_contents) == 0)
    {
    wp_safe_redirect(get_permalink(get_page_by_path(‘cart/cart-empty’)));
    }
    }

    There are so many hooks in woocommerce and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

  • Woocommerce Product Is In Stock Hook

    Woocommerce Product Is In Stock Hook

    Hello, welcome to therichpost.com. In this post, I will tell you Woocommerce Product Is In Stock Hook. WordPress is the best cms and Woocommerce is the best Ecommerce plugin. WordPress hooks(add_action, add_filter) give us the power to edit or change the code without interruption into the files and this is the best thing about wordpress. Now I am going to tell you how the hooks work.

    Woocommerce Product Is In Stock Hook will be useful when we need to stop to purchase that product which is in stock or you can use this in some condition.

    After Hook:

    Before Hook:

    Here is the working and testing code for Woocommerce Product Is In Stock Hook and you need to add this into your theme’s functions.php file:

    add_filter(‘woocommerce_product_is_in_stock’, ‘woocommerce_product_is_in_stock’ );

    function woocommerce_product_is_in_stock( ) {
    return false;
    }

    There are so many hooks in woocommerce and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

  • How to Remove Woocommerce Coupon form from Checkout Page?

    How to Remove Woocommerce Coupon form from Checkout Page?

    Hello, welcome to therichpost.com. In this post, I will tell you, How to Remove Woocommerce Coupon form from Checkout Page? WordPress is the best cms and Woocommerce is the best Ecommerce plugin. WordPress hooks(add_action, add_filter) give us the power to edit or change the code without interruption into the files and this is the best thing about wordpress. Now I am going to tell you how the hooks work.

    Here is the working and testing code for Remove Woocommerce Coupon form from Checkout Page and you need to add this into your theme’s functions.php file:

    remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );

    There are so many hooks in woocommerce and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

  • Woocommerce Email Header Hook

    Woocommerce Email Header Hook

    Hello, welcome to therichpost.com. In this post, I will tell you Woocommerce Email Header Hook. WordPress is the best cms and Woocommerce is the best Ecommerce plugin. WordPress hooks(add_action, add_filter) give us the power to edit or change the code without interruption into the files and this is the best thing about wordpress. Now I am going to tell you how the hooks work.

    With this woocommerce hook you can css to woocommerce email template easily.

    Here is the working and testing code for Woocommerce Email Header Hook and you need to add this into your theme’s functions.php file:

    add_action(‘woocommerce_email_header’, ’email_css’);

    function email_css() {
    echo ‘
    <style type=”text/css”>
    h1 { color: #000; }
    </style>
    ‘;
    }

    There are so many hooks in woocommerce and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

  • Woocommerce Notify Me

    Woocommerce Notify Me

    Hello, welcome to therichpost.com. In this post, I will tell you Woocommerce Notify Me. WordPress is the best cms and Woocommerce is the best Ecommerce plugin. WordPress hooks(add_action, add_filter) give us the power to edit or change the code without interruption into the files and this is the best thing about wordpress. Now I am going to tell you how the hooks work.

    Woocommerce Notify Me Hook functionality will be useful if product is out of stock then user can email to admin with Woocommerce Notify Me hook for purchase that product in future.

    Here is the working and testing code for Woocommerce Notify Me and you need to add this into your theme’s functions.php file:

    add_action( ‘woocommerce_single_product_summary’, ‘my_extra_button_on_product_page’, 30 );
    function my_extra_button_on_product_page() {
    global $product;
    if ( ! $product->managing_stock() && ! $product->is_in_stock() ){
    echo ‘<style>.notify-me input[type=”text”] {
    width: 200px;
    padding-right: 50px;
    }
    .notify-me input[type=”button”] {
    margin-left: -50px;
    background: #23282d;
    color: white;
    border: 0;
    -webkit-appearance: none;
    }</style>’;
    echo ‘<div class=”notify-me”><input type=”text” placeholder=”your Email Address”><input type=”button” class=”btnnotifyme” value=”Notify Me”></div>’;
    }
    }

    In this post, I am just showing the button for notify me and for further functionality, you can comment below.

    There are so many hooks in wordpress and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

  • Cart Notices Woocommerce

    Cart Notices Woocommerce

    Hello, welcome to therichpost.com. In this post, I will tell you Cart Notices Woocommerce. WordPress is the best cms and Woocommerce is the best Ecommerce plugin. WordPress hooks(add_action, add_filter) give us the power to edit or change the code without interruption into the files and this is the best thing about wordpress. Now I am going to tell you how the hooks work.

    You can show notices or any other important information on cart page.

    Here is the working and testing code for Cart Notices Woocommerce and you need to add this into your theme’s functions.php file:

    /*Cart Notices*/
    add_action(‘woocommerce_after_cart_contents’, ‘woocommerce_empty_cart_button’);
    function woocommerce_empty_cart_button( ) {
    echo “<div class=’woocommerce-info’>Order within next 1 hour and your oder will ship today!!</div>”;
    }

    There are so many hooks in wordpress and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

  • WOOCOMMERCE HOOK: ADD CUSTOM BUTTONS ON THE VIEW ORDER PAGE TABLE

    WOOCOMMERCE HOOK: ADD CUSTOM BUTTONS ON THE VIEW ORDER PAGE TABLE

    Hello, welcome to therichpost.com. In this post, I will tell you WOOCOMMERCE HOOK: ADD CUSTOM BUTTONS ON THE VIEW ORDER PAGE TABLE. WordPress is the best cms and Woocommerce is the best Ecommerce plugin. WordPress hooks(add_action, add_filter) give us the power to edit or change the code without interruption into the files and this is the best thing about wordpress. Now I am going to tell you how the hooks work.

    With this Woocommerce Hook, we can add custom buttons on view order page.

    Here is the working WOOCOMMERCE HOOK: ADD CUSTOM BUTTONS ON THE VIEW ORDER PAGE TABLE and you need to this into your theme’s functions.php file:

    /* — WOOCOMMERCE: ADD TRACK, REORDER, PAY & CANCEL BUTTONS ON THE VIEW ORDER PAGE TABLE — */
    add_filter(‘woocommerce_my_account_my_orders_actions’, ‘view_order_action’, 10, 2);
    function view_order_action($actions, $order)
    {
    global $woocommerce;
    // view button
    $actions = array();
    $actions[‘view’] = array(
    ‘url’ => $order->get_view_order_url() ,
    ‘name’ => __(‘View’, ‘woocommerce’)
    );
    // track button
    $actions[‘track’] = array(
    ‘url’ => $order->get_view_order_url().’/#track-order’,
    ‘name’ => __(‘Track’, ‘woocommerce’)
    );
    return $actions;
    }

    There are so many hooks in wordpress and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

  • WOOCOMMERCE HOOK : ADD EMPTY CART BUTTON TO CART PAGE

    WOOCOMMERCE HOOK : ADD EMPTY CART BUTTON TO CART PAGE

    Hello, welcome to therichpost.com. In this post, I will tell you WOOCOMMERCE HOOK : ADD EMPTY CART BUTTON TO CART PAGE. WordPress is the best cms and Woocommerce is the best Ecommerce plugin. WordPress hooks(add_action, add_filter) give us the power to edit or change the code without interruption into the files and this is the best thing about wordpress. Now I am going to tell you how the hooks work.

    With woocommerce Empty cart button, we can easily delete all the products from our cart.

    Here is the working hook for WOOCOMMERCE ADD EMPTY CART BUTTON TO CART PAGE and you need to add this into your theme’s functions.php file:

    /* — WOOCOMMERCE: ADD EMPTY CART BUTTON TO CART PAGE — */
    add_action(‘woocommerce_after_cart_contents’, ‘woocommerce_empty_cart_button’);
    function woocommerce_empty_cart_button( $cart ) {global $woocommerce;$cart_url = $woocommerce->cart->get_cart_url();?>
    <div class=”emptyCart”>
    <?php
    if(empty($_GET)) {?>
    <a class=”button emptycart” href=”<?php echo $cart_url;?>?empty-cart”><?php _e(‘Empty Cart’,’wc-emptycart’); ?></a>
    <?php } else {?>
    <a class=”button emptycart” href=”<?php echo $cart_url;?>&clear-cart=empty-cart”><?php _e(‘Empty Cart’,’wc-emptycart’); ?></a>
    <?php } ?>
    </div>
    <?php }
    // check for empty-cart get param to clear the cart
    add_action( ‘init’, ‘woocommerce_clear_cart_url’ );
    function woocommerce_clear_cart_url() {
    global $woocommerce;

    if ( isset( $_GET[’empty-cart’] ) ) {
    $woocommerce->cart->empty_cart();
    }
    }

    There are so many hooks in wordpress and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com

  • Change Product Order Status Woocommerce Hook

    Change Product Order Status Woocommerce Hook

    Hello, welcome to therichpost.com. In this post, I will tell you Change Product Order Status Woocommerce Hook. WordPress is the best cms and Woocommerce is the best Ecommerce plugin. WordPress hooks(add_action, add_filter) give us the power to edit or change the code without interruption into the files and this is the best thing about wordpress. Now I am going to tell you how the hooks work.

    I am using Change Woocommerce Thankyou Hook to Change Product Order Status.

    Here is the working and testing code for Change Product Order Status Woocommerce Hook and you need to add this into your theme’s functions.php file:

    add_action( ‘woocommerce_thankyou’, ‘Change_Product_Order_Status’, 10, 1 );

    function Change_Product_Order_Status( $order_id ) {

    if ( ! $order_id )
    return;
    $order = wc_get_order( $order_id );
    // Updating order status to processing for orders delivered with Cheque.

    if ( get_post_meta($order->id, ‘_payment_method’, true) == ‘cheque’ )

    $order->update_status( ‘processing’ );
    }

    There are so many hooks in wordpress and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com