• Dear developer,

    When I activate the TikTok plugin for pixel tracking, it deactivates the Side cart theme option. Seems like plugin modify theme files for no reason.

    Please help me!

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi, I had the same issue and I’ve kinda figured out a work-around..

    Before you do any of this make sure to backup your files in case something goes wrong!

    We have to edit a couple of files:

    1st: wp-content/plugins/woocommerce/templates/single-product/add-to-cart/simple.php

    Find the button with name=”add-to-cart”, we need to add the missing data attributes to this button.
    Replace that button with:

    <button type="submit" name="add-to-cart" value="<?php echo esc_attr( $product->get_id() ); ?>" data-product_id="<?php echo esc_attr( $product->get_id() ); ?>" data-product_name="<?php echo esc_attr( $product->get_title() ); ?>" data-price="<?php echo esc_attr( $product->get_price() ); ?>" class="single_add_to_cart_button button alt<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>"> <?php echo esc_html( $product->single_add_to_cart_text() ); ?> </button>

    2nd: wp-content/plugins/tiktok-for-woocommerce/admin/js/ajaxSnippet.js
    On lines 8, 9 and 10 we need to convert ‘thisbutton‘ to a jQuery element.
    Simply replace those variables with:

    var product_id = $(thisbutton).data('product_id');
    var product_name = $(thisbutton).data('product_name');
    var price = $(thisbutton).data('price');

    Later I encountered another issue with TikTok not tracking the conversion values so I changed the price variable to:

    var price = $(thisbutton).data('price') ? $(thisbutton).data('price') : $(".single_add_to_cart_button").data('price') || "0";

    It seems to work fine for now but I haven’t fully tested it yet.

    3rd: wp-content/plugins/tiktok-for-woocommerce/pixel/Tt4b_Pixel_Class.php
    I had some caching issues, you might too so let’s change the ajaxSnippet.js version on line 675 from ‘v1’ to ‘v2’.

    wp_register_script( 'tt4b_ajax_script', plugins_url( '/admin/js/ajaxSnippet.js', dirname( __DIR__ ) . '/tiktok-for-woocommerce.php' ), [ 'jquery' ], 'v2', false );

    And that should be it, good luck!

    P.S: TikTok devs hook me up with some ad credit bro, I’m working hard out here

    • This reply was modified 10 months, 3 weeks ago by masihwoo.
    Thread Starter Rossanelli’s Shop

    (@diiorbuy)

    Wow, the solution you gave me was perfect! I had never experienced help from someone in this way. I really appreciate your time, my store now looks great!

    Thread Starter Rossanelli’s Shop

    (@diiorbuy)

    With the new tiktok update I had problems on my website Get some clothing again. I did the process again but it’s so tedious to do this every time there is an update.

    Plugin Contributor TikTok

    (@tiktokforbusiness)

    We apologize for the difficulties you’re experiencing! Could you kindly?submit a support ticket? Our support team will follow up for further assistance. Please use your TikTok For Business credentials to log in and track your tickets. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Have a conflict between the tiktok plugin and my woocommerce theme’ is closed to new replies.