Skip to content

Commit

Permalink
Adding nullish checks on item values
Browse files Browse the repository at this point in the history
  • Loading branch information
pgilmore-phi committed Oct 23, 2024
1 parent 5f6580d commit 3df2fa1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions blocks/thank-you/thank-you.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ export default async function decorate() {
productTypes.push(pet.nonInsurancePetSummary.membership.itemName);
// push each item object to items array
dlItems.push({
item_name: pet.nonInsurancePetSummary.membership.itemName,
item_name: pet.nonInsurancePetSummary?.membership?.itemName ?? '',
currency: currencyValue,
discount: pet.nonInsurancePetSummary.discount,
discount: pet.nonInsurancePetSummary?.discount ?? '',
item_category: 'membership', // membership
item_variant: '', // okay to be left empty
price: pet.nonInsurancePetSummary.amount,
quantity: pet.nonInsurancePetSummary.membership.quantity,
microchip_number: pet.microChipNumber,
product_type: pet.nonInsurancePetSummary.membership.itemName,
price: pet.nonInsurancePetSummary?.amount ?? '',
quantity: pet.nonInsurancePetSummary?.membership?.quantity ?? '1',
microchip_number: pet.microChipNumber ?? '',
product_type: pet.nonInsurancePetSummary?.membership?.itemName ?? '',
});
}
});
Expand Down Expand Up @@ -194,8 +194,8 @@ export default async function decorate() {
ecommerce: {
transaction_id: externalTransactionID,
affiliation: '24petwatch',
value: summary.totalDueToday,
tax: summary.salesTaxes,
value: summary.totalDueToday ?? '',
tax: summary.salesTaxes ?? '',
shipping: totalShipping ? totalShipping.toFixed(2) : '0.00',
currency: currencyValue,
payment_type: paymentMethod,
Expand Down

0 comments on commit 3df2fa1

Please sign in to comment.