Skip to content

Commit

Permalink
PM-639 Update 'add to cart' DL product type values (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
hero-dokane authored Oct 29, 2024
1 parent 0be9449 commit 6d66920
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions blocks/plans-quote/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,30 +670,30 @@ export default function formDecoration(block) {

function setDataLayer(data) {
const dlItems = [];
const productTypes = [];

if ('petSummaries' in data) {
const { petSummaries } = data;
let membershipName = '';
if (petSummaries && petSummaries.length > 0) {
petSummaries.forEach((pet) => {
membershipName = pet.membershipName ?? '';
productTypes.push(pet.membershipName ?? '');
// push each item object to items array
dlItems.push({
item_name: membershipName,
item_name: pet.membershipName ?? '',
currency: currencyValue,
discount: pet.nonInsurancePetSummary?.discount ?? '',
item_category: 'membership',
item_variant: '', // okay to be left empty
microchip_number: pet.microChipNumber ?? '',
product_type: membershipName,
product_type: pet.membershipName ?? '',
price: pet.nonInsurancePetSummary?.amount ?? '',
quantity: pet.nonInsurancePetSummary?.membership?.quantity ?? '1',
});
});

const trackingData = {
ecommerce: {
product_type: membershipName,
product_type: productTypes.join(', '),
items: dlItems,
},
};
Expand Down

0 comments on commit 6d66920

Please sign in to comment.