• https://ibb.co/HgzYhJg These are my settings im using. The value shows as 1 in the other places like https://ibb.co/3BtmZ55 this. And i have 2 questions

    1) I want to show it as as an editable field. How can i do this? which means user can check it uncheck it again in the cart item. in the cart page it should appear with the value added by the user

    2) i want to show the custom field not before the add to cart button BUT before the add to cart FORM.

    Thank you. Hope to hear from you soon

    • This topic was modified 3 years, 6 months ago by shenalorlof.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author ThemeHigh

    (@themehigh)

    Let me answer your questions one by one.

    >> The value shows as 1 in the other places like https://ibb.co/3BtmZ55 this

    When the checkbox is ticked then the default value of the field will be 1. To make the value to show yes if ticked then set the value field as yes. We have verified the same from your side and it is working fine.

    Please refer to the below screenshots.

    https://prnt.sc/1qsnbft
    https://prnt.sc/1qsn7n3

    >> 1) I want to show it as as an editable field. How can i do this? which means user can check it uncheck it again in the cart item. in the cart page it should appear with the value added by the user

    Unfortunately, it is not possible to edit the fields from cart page.

    >> 2) i want to show the custom field not before the add to cart button BUT before the add to cart FORM.

    The below code is used to show fields before add to cart form.

    add_filter('thwepof_hook_name_before_add_to_cart_button', 'th12345_hook_before_add_to_cart_form',999);
    
    function th12345_hook_before_add_to_cart_form($hook) {
    	$hook = 'woocommerce_before_add_to_cart_form';
    	return $hook;
    }

    We hope this helps.

    Thank you!

    Thread Starter shenalorlof

    (@shenalorlof)

    Wow! Great! Good service. I’ll rate 5 for the service.
    Also please tell me why it’s not possible to add editable field in the cart page.

    Plugin Author ThemeHigh

    (@themehigh)

    We are glad to hear that our update was useful.

    Further, when a product is added to the cart, it will be saved in the cart object as item meta. Woocommerce is not providing any hook or filter for modifying the item meta data from the cart page. So it is not possible to edit the field from the cart page.

    Thank you!

    Thread Starter shenalorlof

    (@shenalorlof)

    Hi dear supporter,
    Then how can we update the quantity of the item from the cart?

    Thread Starter shenalorlof

    (@shenalorlof)

    Please check this will this be helpful for you to implement https://stackoverflow.com/questions/55200491/update-a-custom-field-on-update-cart-click-in-woocommerce-cart/55200667 Because if we can update the quantity why not this

    Plugin Author ThemeHigh

    (@themehigh)

    Thank you for sharing the link.

    The hook mentioned in the link is used to modify the entire cart. With the help of the hook, you can create a custom code to modify the values.

    What we have updated is that there is no direct hook to modify the specific cart item data as in the add to cart submission.

    Thank you!

    Thread Starter shenalorlof

    (@shenalorlof)

    Hi, can u guide with updating the whole cart. So still we can update the values of a specific product nah

    Plugin Author ThemeHigh

    (@themehigh)

    Unfortunately, it is out of our support scope. You need to contact your developer to achieve your requirement.

    Thank you!

    Thread Starter shenalorlof

    (@shenalorlof)

    Hello,
    I have an issue. I added this code

    add_filter('thwepof_hook_name_before_add_to_cart_button', 'th12345_hook_before_add_to_cart_form',999);
    
    function th12345_hook_before_add_to_cart_form($hook) {
    	$hook = 'woocommerce_before_add_to_cart_form';
    	return $hook;
    }

    But now after adding product to the cart this extra field is not showing on the cart page, checkout page or in the invoice. How to fix this?

    Really appreciate a fast solution. Thank you in advance.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Add custom field to cart as editable’ is closed to new replies.