Viewing 2 replies - 1 through 2 (of 2 total)
  • I think the file you need to alter is:
    /plugins/woocommerce/templates/single-product/add-to-cart/external.php

    If your theme has a version of this file, that’s the one to start with. It will be at:
    /themes/your-theme-name/woocommerce/single-product/add-to-cart/external.php

    Don’t change either of these existing files because any edits will be overwritten by updates. Use the appropriate one as a starting point. Your edited version will go in your child theme at:
    /themes/your-child-theme-name/woocommerce/single-product/add-to-cart/external.php

    Thread Starter mobiflora

    (@mobiflora)

    Thanks lorro,

    I figured it out – the following code in functions.php works for me –
    but thanks for your help!

    Till
    @ https://www.mobiflora.de

    remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );

    add_action( ‘woocommerce_single_product_summary’, ‘mobiflora_single_add_to_cart’, 30 );

    function mobiflora_single_add_to_cart(){

    global $product;

    if ( ! $product->add_to_cart_url() ) {
    return;
    }

    $product_url = $product->add_to_cart_url();
    $button_text = $product->single_add_to_cart_text();

    do_action( ‘woocommerce_before_add_to_cart_button’ ); ?>

    <p class=”cart”>
    ‘)” href=”<?php echo esc_url( $product_url ); ?>” target=”_blank” rel=”nofollow” class=”single_add_to_cart_button button alt”><?php echo esc_html( $button_text ); ?>
    </p>

    <?php do_action( ‘woocommerce_after_add_to_cart_button’ );
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘single product page: add conversion tracking to add to chart’ is closed to new replies.