You can use order post meta to check order already there or not. try below code. let me know if this helps you.
$order_id = $order->get_id();
$fbpixel = get_post_meta($order_id, 'fbpixel-'.$order->get_order_number(),true);
if ( $order->get_subtotal() > 0 && ( empty( $fbpixel ) ) ) :
update_post_meta($order_id, 'fbpixel-'.$order->get_order_number(),1);
?>
<script>
fbq('track', 'Purchase', {currency: "AUD", value: <?php echo ($order->get_total() - $order->get_total_shipping()); ?> });
</script>
<?php endif;
Related Posts:
- How to run code when cookie is added?
- How to set up dynamic purchase pixel in Woocommerce?
- How to add a new endpoint in woocommerce
- How to get rid of the hover zoom in WooCommerce single products
- How do I display certain products via their category on a section of a page using PHP?
- Display orders instead of woocommerce my account dashboard for logged in users [closed]
- Detect whether a page is a product subcategory page?
- Programmatically change Payment Methods WooCommerce
- Get WooCommerce Email Classes in Backend
- Use Hooks to Limit One Comment Per User Per Post – Hide Form if Already Commented
- WooCommerce is slow with many categories [closed]
- How to remove recurring totals information for a particular subscription product? [closed]
- WordPress codex: apply_filters – clarification on creating a new hook on the fly. How do we use it?
- Woocommerce – Move product without price a the end
- How to get all attributes with their terms related to specific Woocommerce product category [closed]
- Woocommerce – disable «place order» until user checks Privacy Policy
- Calling calculate_shipping() with ajax in woocommerce
- Accessing parameters when adding filter
- Filter WooCommerce Orders query with user meta data
- Child theme dosn’t overwrite WooCommerce (version 3.4.7)
- How to Show Single Product – 4 Data by ID in Custom Page without over-riding the existing Woo-Commerce
- WOOCommerce redirect after registration to account details
- How can I add an additional action button into the woocommerce admin order page?
- How to add a custom text for order confirmation email template woocommerce
- I want to get the value of a select attribute in the checkout page, and then use it to show or not the delivery data
- woocomerce is serving OR Relation instead of AND on taxonomy product_tag
- Woocommerce Subscriptions – Set Billing Interval/Period
- WooCommerce with ACF: custom fields per product variation
- Woocommerce checkout page reload on up dating shipping method
- change wp_login url and redirect users at the same time
- How to display text between product thumbnail and CTA button on WooCommerce “Shop” page
- Multiple archive product exist
- call_user_func_array() error in class-wp-hook.php
- Error after woocommerce update from 2.6 to 3.5 [closed]
- Send billing info from woocommerce checkout page to paypal checkout form
- Check if a category has a parent category in WooCommerce REST API
- How to – proper WordPress 301 redirects?
- Remove “?add-to-cart=product-id” from Add to Cart URL when on the Cart page
- How to show total amount on woocommerce?
- Changing a text label into an image
- Disable Order Review Page when the id product
- Set both meta_query and tax_query using wp_query->set
- Is there a preset CSS class when shopping cart isn’t empty?
- How to translate text in function.php with WPML [closed]
- Woocommerce product options [closed]
- WordPress SMS API integration without plugin error
- Protecting WooCommerce Customizations with Update
- Setting WooCommerce SKU programmatically [closed]
- How to edit mobile view of my wordpress website without affecting the desktop view? [closed]
- Code specific for specific products
- Change Firstname & Lastname order in the order-processing e-mail templates
- WooCommerce: How to insert filtered attribute(s) in page title of archive?
- Multiple Pricing [closed]
- WOOF product filter prevent from loading on wordpress search result page
- Adding product on sale into specific category after creation
- Trying to run Javascript on AJAX call
- How to select the first product variant as a default?
- WooCommerce – dynamically loading checkout page using ajax not showing payment methods for guest
- Two Filter Issue [closed]
- Show notice to user based on User Meta
- Pass values to ajax
- Send Email to Custom Field in Custom Post Type when order is Completed
- Fragments to Update Cart Counter not working on homepage – Woocommerce
- WooCommerce Review Author Hook on Review Submission
- woocommerce ad custom button with custom link after add to cart for every product
- Order Woocommerce Products by On Sale and Alphabetically
- How to track product price changes?
- Woocommerce Flexslider touch functionality on desktop not working
- Filter orders in Admin area based on logged in user
- Exclude Specific Product Category for showing up in its parent category page
- How to fire a disabled WooCommerce New Order notification?
- Set up PayPal with wrong email by mistake
- How to echo woocomerce attributes values in dropdown box
- Add new page in WooCommerce My Account page
- Woocommerce section name? [closed]
- how to change value return by _stock_status
- Woocommerce customer role doesn’t change if user is already a subscriber [closed]
- Tags pages for different Custom Post Types and WooCommerce Products sharing Post Tags
- woocommerce_email_recipient_new_order not triggered
- Load custom post template
- get_posts only getting most recent product
- How to only show featured products in wooCommerce using function.php function
- How to insert link, with lightbox, that opens specific page content only
- Remove plugin function and add it back in via functions.php
- Vendor Listing by Location
- Woocommerece category page showing in stock product as out of stock
- Increase product variation limit in woocommerce
- WooCommerce widget “WooCommerce Products” template [closed]
- WooCommerce show decimals in totals [closed]
- Woocommerce Mandatory Field on Shipping Details [closed]
- Create a shortcode to show product tag name on tag archive
- How to access Woo Commerce products from within custom theme? [closed]
- Use Homepage as “Shop” for Woocommerce [closed]
- How to display India country first in country selection drop down list in WordPress
- registration_errors not working
- Translate Woocommerce tab
- Woocommerce -> gallery images per variation without a plugin? [closed]
- Why is my WordPress admin not working
- Verify if woocommerce supports this design [closed]
- Hook for Woocommerce checkout fields