Skip Navigation

[Resolved] Add product – Manage stock

This support ticket is created 3 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 4 replies, has 3 voices.

Last updated by Jamal 3 years, 7 months ago.

Assisted by: Jamal.

Author
Posts
#2014013

Hello,

I want that the user when adding a product set the stock available. So I've added the _manage_stock field to the "Add" and "Edit" form but it has no effect on the product created. I need to go to the backend and then activate it because is recorded without the manage stock check hidden link

Also, the visual of this attribute it's not good hidden link, I can set a label for the field, but the field name and a big check box is added hidden link

Thanks

#2014379

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share problem URL where you added your form to add the product as well as admin access details so I can check why manage stock field is not get respected.

#2015757

Thanks

#2015955

Hello! Minesh won't be available for a couple of days. If you don't mind, I'll continue with you on this ticket.

I confirm, that the credentials are working. I just need to know where this form is used? And with what user should I test it(admin, Alex, another user)? I am setting your next reply as private if you need to add more credentials.

#2016873

We can hide the '_manage_stock' label using CSS. I added the following code to the form and it works as expected:

.js-wpt-field-items[data-item_name=checkbox-_manage_stock] label {
    display: none;
}

Regarding the stored value for the _manage_stock field, Toolset will save a checkbox field as 1(checked) or 0(unchecked). While WooCommerce expects to have a value "yes" or "no" for the field. That's why the _manage_stock is not reflected in WooCommerce.

You will need to use a custom PHP code snippet, hooked to the cred_submit_complete action, that will save "yes/no" depending on the form's field data. Let me know if you need help with this.
https://toolset.com/documentation/programmer-reference/cred-api/#cred_submit_complete

You can see some code for inspiration in this reply https://toolset.com/forums/topic/function-for-form-2-is-performed-on-form-1/#post-281606