Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #4501979
Child product count at checkout to determine flat rate postage cost
Open

Comments

  • David started the conversation

    WPC Product Bundles for WooCommerce (Premium)

    Hi,

    I have 3 flat rates for postage (1-3 items, 4-6 items, 7+ items) with different costs. When I add a bundle to the cart (no matter how many items are in the bundle) it only sees it as one item.  Is there a way that I can count the child items only, and exclude the bundle from the count?

    Example - bundle 1 has 4 items, bundle 2 has 3 items. 7 items total, I need the correct count in order to select the correct postage option automatically for 7+ items at checkout.

    My php code "snippet" works to count individual items and the thresholds work - it changes the postage cost dynamically with the product count in the cart for individual items as per design, but it only sees bundles as a single item, and no matter how hard I try - I can't seem to hook in. 

    How does WPClever store the child products of a bundle, is it wpcb_bundle_items? What do I hook into to get an accurate count of child items, please? Any help or guidance appreciated.

  •  1,542
    Dustin replied

    Hi David,

    For the cart items counter on the frontend, you can use this option:

    7999645099.png

    If you want to count the products in the cart manually for your own purposes, you can use the following:

    The main bundle product will have cart item data: woosb_ids
    The child products inside the bundle will have cart item data: woosb_parent_id

    5189574082.png

    Best regards,
    Dustin