33 * @author Maritim, Kip
44 * @copyright (c) 2023, Bread Financial
55 *
6- * @var Bread\BreadCheckout\Block\CatalogProductCollection $block
6+ * @var Bread\BreadCheckout\Block\Catalog\ProductCollection $block
77 */
88$ collection = $ block ->getCategoryProductCollection ();
99$ products = array ();
@@ -21,30 +21,33 @@ endforeach;
2121 var currentCurrencyCode = "<?= /* @noEscape */ $ block ->getCurrentCurrencyCode (); ?> ";
2222 var placementObject = [];
2323 <?php foreach ($ products as $ product ) : ?>
24- var itemPlacement = {
25- "allowCheckout": allowCheckout,
26- "financingType": "installment",
27- "domID": 'bread-checkout-btn-<?= /* @noEscape */ $ product ['id ' ];?> ',
28- "locationType": buttonLocation,
29- "order": {
30- "items": [
31- {
32- "name": "<?= /* @noEscape */ $ product ['name ' ]?> ",
33- "quantity": <?= /* @noEscape */ $ product ['quantity ' ]?> ,
34- "shippingCost": {"currency": currentCurrencyCode, "value": 0},
35- "shippingDescription": "",
36- "unitTax": {"currency": currentCurrencyCode, "value": 0},
37- "unitPrice": {"currency": currentCurrencyCode, "value": <?= /* @noEscape */ $ product ['price ' ]?> }
24+ var price = <?= /* @noEscape */ $ product ['price ' ]?> ;
25+ if(price != 0) {
26+ var itemPlacement = {
27+ "allowCheckout": allowCheckout,
28+ "financingType": "installment",
29+ "domID": 'bread-checkout-btn-<?= /* @noEscape */ $ product ['id ' ];?> ',
30+ "locationType": buttonLocation,
31+ "order": {
32+ "items": [
33+ {
34+ "name": "<?= /* @noEscape */ $ product ['name ' ]?> ",
35+ "quantity": <?= /* @noEscape */ $ product ['quantity ' ]?> ,
36+ "shippingCost": {"currency": currentCurrencyCode, "value": 0},
37+ "shippingDescription": "",
38+ "unitTax": {"currency": currentCurrencyCode, "value": 0},
39+ "unitPrice": {"currency": currentCurrencyCode, "value": <?= /* @noEscape */ $ product ['price ' ]?> }
40+ }
41+ ],
42+ "subTotal": {"currency": currentCurrencyCode, "value": <?= /* @noEscape */ $ product ['price ' ]?> },
43+ "totalPrice": {"currency": currentCurrencyCode, "value": <?= /* @noEscape */ $ product ['price ' ]?> },
44+ "totalDiscounts": {"currency": currentCurrencyCode, "value": 0},
45+ "totalShipping": {"currency": currentCurrencyCode, "value": 0},
46+ "totalTax": {"currency": currentCurrencyCode, "value": 0}
3847 }
39- ],
40- "subTotal": {"currency": currentCurrencyCode, "value": <?= /* @noEscape */ $ product ['price ' ]?> },
41- "totalPrice": {"currency": currentCurrencyCode, "value": <?= /* @noEscape */ $ product ['price ' ]?> },
42- "totalDiscounts": {"currency": currentCurrencyCode, "value": 0},
43- "totalShipping": {"currency": currentCurrencyCode, "value": 0},
44- "totalTax": {"currency": currentCurrencyCode, "value": 0}
45- }
46- };
47- placementObject.push(itemPlacement);
48+ };
49+ placementObject.push(itemPlacement);
50+ }
4851 <?php endforeach ; ?>
4952 if (typeof window.BreadPayments !== 'undefined' || typeof window.RBCPayPlan !== 'undefined') {
5053 var bread_sdk = null;
0 commit comments