Insert Product Addons in WooCommerce via Api - woocommerce

I have to sync WooCommerce with other platforms. The products have some options
that user can choose , for example size .. so I need a way to populate this data via the API but the Rest api seems does not provide this ( only attributes can be populated but they are not same, user can not pick some one of them ) and not sure which plugin to use for that.

Related

WordPress : trigger action when CPT created from API, or when updated from UI

I am searching all places for a way to update a post once it has been created or updated and saved (including meta data). In my case, new posts are and will always be created from the WP REST API only, and can be updated from the WP REST API and/or the WP UI.
I got the the post update portion of code, relying solely on a post meta field, up and running, working on itself. But I can’t find what hook to use to achieve the post update:
save_{cpt_name} -> post_meta is null, whatever the priority,
rest_insert_{cpt_name} -> not called on post update,
wp_after_insert_post -> not called on post update,
If you ave a reliable hook for me to play with, or a solution where I can grab a post meta key on post create, and post update, whatever the source (API or UI), could you share it with me ?
Thanks.

Gravity forms: uploading files to document library pro under selected category

I am using Barn2 document library pro and I want to use gravity forms to allow users to submit documents (basically doc,xls and pdf)
1- a dropdown or checkbox forms to select the document category, subcategory, tag and whatever taxonomy which shall be fetched from the actual document library.
2- The document is automatically assigned to the selected category and tags.
3- must verified by an admin first (I think this is a native feature of WordPress)
is this possible to implement? maybe a custom code? or should I purchase another 3rd party addon like gravitywiz populate anything?
btw I still didn't purchase any plugin since there's no single answer to my questions.

How can I set values for a Wordpress Post's Plugin fields via REST-API

I am posting to Wordpress using the REST-API, and I need to set a variety of 'fields' for a post that are included from various plugins. As an simple example, I have an AMP plugin that has a checkbox "Use This Content as AMP Content" and a full editor for the actual AMP content. I could obviously install or uninstall plugins at any time, and I would hope WP-REST would handle it gracefully, or presumably, maybe I need to do a query before each post (in which case, how would that work)?
As far as I understand the REST-API, these fields are not 'meta' fields (I could be wrong).
Is there a way to set these (and other) fields using WP-REST API, or would I need to write my own plugin to expose those fields TO the WP-REST API. If that is the case (and it might very well be), how would I find a list of the available fields for a post?

How can i get same checkout fields in mobile application

I am finishing my mobile application and now in the checkout screen, i want to show the same fields as i configure in woocommmerce store, i.e: default country, required fields cities value etc.
Similarly i am looking a way to get the same shipping rules i set for online store, so on preview i can show the same value.
Is there any way i can achieve this?? i looked into the documentation as in below mentioned link, but it does not shows how can i retrieve the configuration data for checkout.
http://woocommerce.github.io/woocommerce-rest-api-docs/#order-properties
Appreciate community help.
I think is not possible, you would need to create a custom plugin that creates a new endpoint and using these hooks you get checkout fields and list them:
$address_fields = apply_filters('woocommerce_billing_fields', $address_fields);
$address_fields = apply_filters('woocommerce_shipping_fields', $address_fields);
You can find more info at: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

build REST API for WooCommerce for mobile apps

we are building the REST API for WooCommerce and we want to add a product to user's cart. For that we have used Cart API for WooCommerce but it doesn't seems to working for us as it doesn't giving any option to set user_id along with the data so we are facing issues with mobile app and website syncing. We want to make it generalize like if user is using mobile and adds product to cart, it should be remain in the cart if login from web too and it's seems not working for us
Any help will be appreciated for it
Thanks in advance
Woo-commerce cart items is temporary store in session so you can not get items using REST API, for that you have to make a custom table of cart then store details in your custom cart table using REST API.

Resources