Support

Account

Home Forums ACF PRO Woocommerce custom field item cart Reply To: Woocommerce custom field item cart

  • Hi @wax

    If you want to add the form to the product page, then you need more advanced code and logic. Unfortunately, I can only guide you with the logic. I’m sorry about that.

    Like my answer in your other thread, you can use the repeater field and add it to the front-end by using this code:

    acf_form(array(
        'form' => false,
    ));

    This will strip the ACF’s form tag and let you add it in the add to cart form instead.

    When a user clicked the add to cart button, you can get the repeater value by using this code:

    $repeater_values = $_POST['acf']['field_1234567890abc'];

    Where ‘field_1234567890abc’ is the field key of the repeater. At this time, you need to modify the cart content so it can hold the extra information. Here’s an example how to do it: http://wordpress.stackexchange.com/questions/138595/add-custom-variable-to-cart-content. I’m not sure if it will work or not, though. Please consult to WooCommerce for more information.

    I’m not sure if you need to modify the order or not after this process, but I guess you can try it out to find out 🙂

    Hope this makes sense.