Forum Replies Created

Viewing 15 replies - 1 through 15 (of 63 total)
  • I just updated and gave it a test spin, however the purchase event is not tracked on the thank you page.

    in facebook-commerce-events-tracker.php a check exists:

    // use a session flag to ensure this Purchase event is not tracked multiple times
    $purchase_tracked_flag = '_wc_' . facebook_for_woocommerce()->get_id() . '_purchase_tracked_' . $order_id;


    // Return if this Purchase event has already been tracked.
    if ( 'yes' === get_transient( $purchase_tracked_flag ) || $order->meta_exists( '_meta_purchase_tracked' ) ) {
    return;
    }

    basically when the order is created it will add the meta and prevent the code being executed…

    I will try to find some time tomorrow to submit a PR that resolves this.

    I have the same issue and i pinpointed the culprit.

    // Purchase and Subscribe events
    add_action( 'woocommerce_new_order', array( $this, 'inject_purchase_event' ), 10 );
    add_action( 'woocommerce_process_shop_order_meta', array( $this, 'inject_purchase_event' ), 20 );
    add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'inject_purchase_event' ), 30 );
    add_action( 'woocommerce_payment_complete', array( $this, 'inject_purchase_event' ), 40 );
    add_action( 'woocommerce_order_status_processing', array( $this, 'inject_purchase_event' ), 50 );
    add_action( 'woocommerce_order_status_completed', array( $this, 'inject_purchase_event' ), 60 );
    add_action( 'woocommerce_thankyou', array( $this, 'inject_purchase_event' ), 70 );

    The event is injected to multiple hooks however most of us want to inject it on the thank you page only. The issue is with the prevention of multiple trigger logic here:

    // use a session flag to ensure this Purchase event is not tracked multiple times
    $purchase_tracked_flag = '_wc_' . facebook_for_woocommerce()->get_id() . '_purchase_tracked_' . $order_id;

    // Return if this Purchase event has already been tracked or order state is invalid.
    if ( 'yes' === get_transient( $purchase_tracked_flag ) || $order->meta_exists( '_meta_purchase_tracked' ) || ! in_array( $order_state, $valid_purchase_order_states, true ) ) {
    return;
    }

    // Mark the order as tracked for the session.
    set_transient( $purchase_tracked_flag, 'yes', 45 * MINUTE_IN_SECONDS );

    // Set a flag to ensure this Purchase event is not going to be sent across different sessions.
    $order->add_meta_data( '_meta_purchase_tracked', true, true );

    // Save the metadata.
    $order->save();

    Basically it will fail the check once metadata is saved and that will happen on the first hook so your purchase event will never see the thank you page.

    I needed a temp fix and I commented out the following:

    add_action( 'woocommerce_new_order', array( $this, 'inject_purchase_event' ), 10 );
    add_action( 'woocommerce_process_shop_order_meta', array( $this, 'inject_purchase_event' ), 20 );
    add_action( 'woocommerce_checkout_update_order_meta', array( $this, 'inject_purchase_event' ), 30 );
    add_action( 'woocommerce_payment_complete', array( $this, 'inject_purchase_event' ), 40 );
    add_action( 'woocommerce_order_status_processing', array( $this, 'inject_purchase_event' ), 50 );
    add_action( 'woocommerce_order_status_completed', array( $this, 'inject_purchase_event' ), 60 );

    and my Purchase event works on the thank you page

    Thread Starter Stefan Vasiljevic

    (@stefanue)

    That is great news! Thank you!

    That one can be tricky basically the ajax can’t be executed for non-logged in users. Can you please share the system status and logs?

    • System Status: You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”. Once you’ve done that, paste it here in your response.
    • Error log: share a copy of the fatal error log found under WooCommerce > System Status > Logs (if available)

    As far as I can see you have a 403 response (Forbidden) on your AJAX script that is running on checkout. As a first step I would fix that and take it from there.

    POST https://www.mghlonline.be/?wc-ajax=update_order_review 403

    That error might be the source of the issue you’re currently experiencing.

    Hi @loopforever,

    This should work:

    $customer = wp_get_current_user(); // do this when user is logged in
    $customer_orders = get_posts(array(
      'numberposts' => -1,
      'meta_key' => '_customer_user',
      'orderby' => 'date',
      'order' => 'DESC',
      'meta_value' => get_current_user_id(),
      'post_type' => wc_get_order_types(),
      'post_status' => array_keys(wc_get_order_statuses()), 
      'fields' => 'ids',
    ));
    
    $user_orders = array(); //
    foreach ($customer_orders as $orderID) {
      $orderObj = wc_get_order($orderID);
      $user_orders[] = array(
        "orderID" => $orderObj->get_id(),
        "orderTotal" => $orderObj->get_total(),
        "orderDate" => $orderObj->get_date_created()->date_i18n('Y-m-d h:i:s'),
      );
    }
    echo '<pre>';
    var_dump($user_orders);
    echo '</pre>';

    Hi @wpnewbie14 you can try with this one:

    // Display variations dropdowns on shop page for variable products
    add_filter( 'woocommerce_loop_add_to_cart_link', 'show_var_on_shop' );
    function show_var_on_shop() {
        global $product;
        if( $product->is_type( 'variable' )) {
            woocommerce_variable_add_to_cart(); //simple :)
        } else {
    	echo sprintf( '<a rel="nofollow" href="%s" data-quantity="%s" data-product_id="%s" data-product_sku="%s" class="%s">%s</a>',
            esc_url( $product->add_to_cart_url() ),
            esc_attr( isset( $quantity ) ? $quantity : 1 ),
            esc_attr( $product->get_id() ), // get_id() instead of id
            esc_attr( $product->get_sku() ),
            esc_attr( isset( $class ) ? $class : 'button' ),
            esc_html( $product->add_to_cart_text() )
    	);
        }
    }

    I think it has something to do with DNS SPF record or DMARC. One of the common issues is that the domain it was sent from doesn’t match the domain in the “From:” address.

    To fix the issue:

    • Publish an SPF record that includes the IPs of the vendor or affiliates which send your messages.
    • Sign your messages with a DKIM signature that is associated with your domain.
    • Make sure the domain in the “From:” address matches the domain you’re using to authenticate your emails.

    Hi @klous-1, as Mirko already suggested, it’s most likely an issue with your host.

    You can try to install this plugin it can report some common WP cron issues so you will get some insight faster than from your host 🙂

    Forum: Plugins
    In reply to: [WooCommerce] Email name

    Hi @basvweb it might be using your admin email.

    Check your email address in Settings->General->Administration Email Address

    Also some plugins can override the default settings, so please check this as well.

    I used Avalara on lots of projects for US based shops and it works really well.

    Hi @gemmalcurran, It only applies to products that have manage stock option enabled. When you don’t have that option enabled, the assumption is that you have an unlimited stock 🙂

    Hi @hamudi I can still see the related products hidden on your product page. The snippet i shared above will only work if you don’t have hard-coded related products on single product template.

    Can you please check your single product template?

    It should be in your theme folder, woocommerce/content-single-product.php the second file you should check is woocommerce/single-product/related.php

    You’re welcome 🙂

    So this is not a default WooCommerce behaviour, this might be added to Divi theme you are using.

    Please try adding this snippet you your functions.php file and it might help

    add_action( 'wp', 'wdc_woo_checkout_tc' );
    function wdc_woo_checkout_tc() {
        remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_terms_and_conditions_page_content', 30 );
    }
Viewing 15 replies - 1 through 15 (of 63 total)