bigcommerce / b2b-buyer-portal

B2B Buyer Portal - BigCommerce B2B Edition
MIT License
25 stars 19 forks source link

Shopping List for Category Page #58

Open SunilP-WassDigital opened 2 months ago

SunilP-WassDigital commented 2 months ago

Type: (Select one)

Requirement :

I m using below tutorial to do that https://help.bundleb2b.com/en/articles/7322862-hard-coding-floating-action-buttons

Implement `templates/components/f/products/card.html

<button class="add-to-shopping-list" data-product-id="{{id}}" data-sku="{{sku}}">Add to shopping list</button>
<script>
    document.addEventListener("DOMContentLoaded", function() {
        $(".add-to-shopping-list").on('click', function (event) {
            let pId = $(this).attr('data-product-id');
            let sku = $(this).attr('data-sku');
            b2b.utils.shoppingList.addProductFromPage({
                quantity: 1,
                productEntityId: pId,
                selectedOptions:[],
                sku: sku,
                variantEntityId:118019
            })
        });
    })
</script>

`

Expected Behavior:

Actual Behavior:

Debugging On click on shopping list , it showing selection of shopping list but when click on "OK" nothing happen Debugging more found that https://github.com/bigcommerce/b2b-buyer-portal/blob/main/apps/storefront/src/pages/PDP/index.tsx#L175 it is going to this file, where it is need pdp form and all thing. Even i m not getting actual click event of element as well.