• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2899

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Checkout

PHP Pass Thank You Page Product Data Using jQuery Script in WooCommerce

Category: WooCommerce Tags: get_items, get_line_subtotal, get_line_total, get_product, get_sku, get_total, jQuery, json_encode, wc_get_order, woocommerce_thankyou
  • Description
  • Reviews (0)

Add this PHP code to your child themes functions file to get the product data for every sale from your thank you page.

The order object contains all the order data you can use in jQuery or PHP.

Here’s the output you can view in the source code or console screen when you inspect the output:

You can also pass customer product data like the product ID & price like this :

Outputs the values for the data passed from PHP code to jQuery in simple text using json format on the customers Thank You page.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Primary Sidebar

Written by Brad Dalton specialist for WooCommerce. Read More…

Advertise · WPEngine · Genesis · Log in

  • Code Snippets
  • Tutorials
  • Videos
  • Tags
  • Account
  • Checkout
  • Cart
  • Hire Me