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

Okay
  Public Ticket #3960934
No longer working with WordPress/woocommerce plugin "3D Print"
Open

Comments

  •  1
    Jason started the conversation

    How can I hook into your wpcss-products POST to get full WooCommerce cart data (including variation ID and attributes)? I need it to be compatible with a plugin that relies on standard Woo cart requests.

  •  1,468
    Dustin replied

    Hi Jason,

    Each shared cart has a key. You can retrieve the cart data from a key like this:

    5865861511.png

    Best regards,
    Dustin

  •  1
    Jason replied

    Thank you! With this help I was able to get my functionality back! Thank you!

  •  1
    Jason replied

    Seems I was premature in my success. I am working with the plugin 3DP (https://www.wp3dprinting.com/) which creates an items with some unique attributers. I am getting an error when clicking "add selected items to cart" which leads me to "Invalid Value posted for Printer"

  •  1
    Jason replied

    1. Share Cart POST Format for Variable Products:

    "When using the Share Cart plugin with variable products that have attributes stored as custom taxonomies (e.g., pa_p3d_printer), does Share Cart POST the selected attribute values using the term ID, slug, or label?"

    (Follow-up: Can this behavior be configured?)

    2. Attribute Validation Compatibility:

    "WooCommerce 7.8+ and 9.x have stricter variation attribute validation.
    Is Share Cart explicitly preparing the posted attribute fields in a format WooCommerce expects for variable products, or does it just dump the cart's raw attribute values?"

    (Follow-up: If not corrected automatically, is there a hook to intercept/modify the attributes before submit?)

    3. Customization Hooks or Filters:

    "Is there an official hook or filter inside Share Cart to modify the attributes or cart item data before the 'Add Selected Products to Cart' form is submitted or processed?"

    (Follow-up: If so, where is it documented or can you provide an example?)

  •  1,468
    Dustin replied

    I understand you will need to do a lot of work to make it compatible with 3D Printing. However, I cannot help you with those details. You must read the plugin code and tell me where we should adjust or add filter hooks to support your work. I will help you do that.

    For example, in the latest version 2.1.5, we added a filter hook here:

    8120655968.png

    So you can adjust any value before adding the saved product to the cart.

    Best regards,
    Dustin

  •  1
    Jason replied

    Thanks for your willingness to collaborate.

    We’re integrating your Share Cart plugin with the 3DPrint plugin, which requires certain attributes (like pa_p3d_printer, pa_p3d_material, etc.) to be passed as term IDs, not slugs or names. Additionally, file-related data comes from a paired file manager and must be rehydrated before cart restore.

    Right now, we're hitting errors like:
    "Invalid value posted for Printer" during restore.

    Request:

    Please add a filter before add_to_cart() is called so we can modify attributes as needed.

    Proposed hook:

    $product_args = apply_filters('wpc_share_cart_pre_add_to_cart_args', $product_args, $product_id);
    

    Placing this right before the cart add logic would let us normalize or reroute the data through p3d_add_cart_handler() (used by 3DPrint to bypass strict validation).

    Happy to provide sample code if needed.

  •  1,468
    Dustin replied

    As per my previous reply, I already added a filter hook at this position:

    8120655968.png

    // Filter args before adding to the cart
    $args = apply_filters( 'wpcss_add_to_cart_args', $args, $cart_item );

    You can retrieve the product ID from $cart_item:

    $product_id = $cart_item['product_id'];

    Best regards,
    Dustin