• Is there an easy way to move the field to a different spot on the page? It’s showing up after the add to cart button. Is there a shortcode, or even some custom code I can use in functions.php to change the location?

    Thanks!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @jayesel,

    After reading your comments I created a new filter for that. It’s called 'aopwc_frontend_input_filter'. Its default value is 'woocommerce_before_add_to_cart_button' but you can change it to anything you want, like 'woocommerce_after_add_to_cart_button'.

    Here is an example of how it would work:

    <?php
       add_filter( 'aopwc_frontend_input_filter', function ( $filter = 'woocommerce_before_add_to_cart_button' ) {
        $filter = 'woocommerce_after_add_to_cart_button';
        return $filter;
    } );
    ?>

    You could add it on your functions.php
    Please give it a try and tell me if it suits you ??

    Thread Starter jayesel

    (@jayesel)

    Thanks! No luck yet. I tried a few things to try to fix it but nothing seemed to work. Should there be a WC hook in the add_filter line? Like below (filter_name):

    add_filter( 'filter_name', 'your_function_name' );
    
    function your_function_name( $variable ) {
    // Your code
    return $variable;
    }

    Thanks for your help!

    Anytime ??
    Hum, let me think.

    Should there be a WC hook in the add_filter line? Like below (filter_name):

    Actually you only need to change this part
    $filter = 'woocommerce_after_add_to_cart_button';

    You can replace this filter by many others, like:

    • woocommerce_before_add_to_cart_form
    • woocommerce_before_add_to_cart_button
    • woocommerce_after_add_to_cart_button
    • woocommerce_after_add_to_cart_form
    • This reply was modified 6 years, 7 months ago by Pablo Pacheco.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘change location of the field’ is closed to new replies.