Ecommerce Shopify WordPress Discussion

Unable To Add 'Line_item' Property From 'Checkout' Object To DataLayer On The Order Status Page

I'm trying to get the value of a checkout object property to get pushed to the dataLayer on the Order Status page after a purchase. But for some reason I can't seem to access it. The image attached shows that the 'selling_plan_name' property exists in checkout.line_items[0].selling_plan_name. But when calling that directly in Order Status Page>Additional scripts I can't get it to show in the dataLayer. Ideally, I'll be able to iterate through the purchased items and push to the DL in an array, but first just trying to figure out why this can't be picked up. Also, here's the dataLayer script I'm using. subscriptionStatus is this new property I'm trying to call by following the same format as the others in the line_items loop: {% comment %} Purchase data layer v2.1 - part of "Shopify GA4 Kit" by Analyzify Visit https://analyzify.app/shopify-google-analytics/ga4 for complete tutorial {% endcomment %} {% assign template_name = template.name %} <script type="text/javascript"> window.dataLayer = window.dataLayer || []; window.appStart = function(){ window.allPageHandle = function(){ window.dataLayer.push({ event: "ga4kit_info", contentGroup: "{{ template_name }}", {% if customer %} userType: "member", customer: { id: "{{- checkout.customer.id | json -}}", lastOrder: "{{- customer.last_order.created_at | date: '%B %d, %Y %I:%M%p' -}}", orderCount: "{{- checkout.customer.orders_count | json -}}", totalSpent: "{{- checkout.customer.total_spent | times: 0.01 | json -}}", tags: {{- checkout.customer.tags | json -}} } {% else %} userType: "visitor", {% endif %} }); }; allPageHandle(); {% if first_time_accessed %} var shippingPrice = "{{shipping_price | money_without_currency }}".replace(",", "."); var totalPrice = "{{checkout.total_price | money_without_currency }}".replace(",", "."); var subTotal = "{{checkout.subtotal_price | money_without_currency }}".replace(",", "."); var taxPrice = "{{tax_price | money_without_currency }}".replace(",", "."); var orderItemsName = []; var orderItemsId = []; var orderItemsCategory = []; var orderItemsBrand = []; var orderItemsType = []; var orderItemsPrice = []; var orderItemsSku = []; var subscriptionStatus = []; var orderItemsvariantId = []; var orderItemsQuantity = []; var orderItemsvariantTitle = []; var totalQuantity = 0; var customerEmail = "{{customer.email}}"; var customerPhone = {{- checkout.shipping_address.phone | json -}}; var customerFirstname = {{- checkout.shipping_address.first_name | json -}}; var customerLastname = {{- checkout.shipping_address.last_name | json -}}; var customerCity = {{- checkout.shipping_address.city | json -}}; var customerCountry = {{- checkout.shipping_address.country | json -}}; var customerState = {{- checkout.shipping_address.province | json -}}; var customerZip = {{- checkout.shipping_address.zip | json -}}; {% for line_item in checkout.line_items %} orderItemsName.push("{{ line_item.product.title | remove: "'" | remove: '"'}}"); orderItemsId.push("{{ line_item.product_id }}"); subscriptionStatus.push("{{ line_item.selling_plan_name | remove: "'" | remove: '"' }}"); orderItemsPrice.push("{{ line_item.price | times: 0.01 }}"); orderItemsSku.push("{{ line_item.sku | remove: "'" | remove: '"' }}"); orderItemsQuantity.push("{{ line_item.quantity }}"); orderItemsvariantId.push("{{ line_item.variant_id }}"); orderItemsvariantTitle.push("{{ line_item.variant.title }}"); orderItemsCategory.push("{{ line_item.product.collections.last.title | remove: "'" | remove: '"' }}"); orderItemsBrand.push("{{ line_item.vendor | remove: "'" | remove: '"' }}"); orderItemsType.push("{{ line_item.product.type | remove: "'" | remove: '"' }}"); totalQuantity += {{ line_item.quantity }}; {% endfor %} window.dataLayer.push({ page_type: "purchase", event: "analyzify_purchase", currency: "{{ shop.currency }}", totalValue: totalPrice, totalValueStatic: totalPrice, subTotal: subTotal, currencyRate: window.Shopify.currency.rate, shipping: shippingPrice, tax: taxPrice, payment_type: "{{order.transactions[0].gateway}}", {% if order.name %} transaction_id: "{{order.name | remove: "'" | remove: '"'}}", {% else %} transaction_id: "{{checkout.id | remove: "'" | remove: '"'}}", {% endif %} productName: orderItemsName, productId: orderItemsId, productBrand: orderItemsBrand, productCategory: orderItemsCategory, productVariantId: orderItemsvariantId, productVariantTitle: orderItemsvariantTitle, productSku: orderItemsSku, productType: orderItemsSku, productPrice: orderItemsPrice, productQuantity: orderItemsQuantity, email: customerEmail, phone: customerPhone, CustomerFirstName: customerFirstname, CustomerLastName: customerLastname, CustomerCity: customerCity, CustomerCountry: customerCountry, CustomerState: customerState, CustomerZip: customerZip, SubscriptionStatus: subscriptionStatus }); {% endif %} } appStart(); </script> No matter what I try the array comes back blank in the dataLayer. If it's available via the console, what's stopping me from being able to pull that value? Any help would be much appreciated! I would expect the dataLayer variable I've setup in GTM to now show the values for selling_plan_name but instead it comes back blank.
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.