Mike Jolley on "custom field, woocommerce, checkout"

ساخت وبلاگ

Hi,

I've created some custom fields in the User account using PODS, and added the following code in my theme's functions.php to add these fields to the check out page:

http://pastebin.com/ZppGDZQ9

There's one last custom field I created in the user account with PODS I'd like to add to the checkout, and this is 'category'.

I'd like the name of the WooCommerce product saved into this field. The WC product will be a WC Subscription variable type product.

How do I make this happen on the check out page?

Thanks.

https://wordpress.org/plugins/woocommerce/

Unfortunately the code in http://pastebin.com/ZppGDZQ9 does not save the info entered @ checkout into the user acccount custom fields.

I'd love some help with this.

Hi Mike,

Thanks. That page (@ Lesson 3 – Adding a custom special field) is the one I used to create the code @ http://pastebin.com/ZppGDZQ9 which does not save the into entered into the custom fields at checkout into the user meta.

The custom fields were created using PODS, and PODS support advise the custom fields created by PODS are genuine WordPress custom fields, not 'special' custom fields that don't work with other plugins.

I've updated http://pastebin.com/ZppGDZQ9 with the most recent code I am using.

You're missing the code in the tutorial after "Finally, let’s save the new field to order custom fields using the following code:"

Ahh. Thanks.

I made those changes. My updated code is @ http://pastebin.com/ZppGDZQ9

The custom fields do not save though.

Here are the custom fields I created with PODS:
http://i112.photobucket.com/albums/n180/SRD001/fields.png

These custom field names match the field names in http://pastebin.com/ZppGDZQ9, so I can't see what the problem is.

Can you help please?

Check the form itself and ensure the field names match what you're checking for in POST.

And look in the custom fields section of the order - thats where they would be stored since you're using plain names for each meta key.

I see that the custom field information is being saved into the custom order section of the order I made.

I need this information to be saved into the custom fields of the user meta though.

Then you need to change the save code you added last.

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 76 تاريخ : يکشنبه 29 فروردين 1395 ساعت: 17:56