Title: Buy restriction problem
Last modified: June 2, 2024

---

# Buy restriction problem

 *  Resolved [kosmic69](https://wordpress.org/support/users/kosmic69/)
 * (@kosmic69)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/buy-restriction-problem/)
 * Hi,
 * I’m trying to create a new product with woocommerce api. For my purpose I need
   to restrict the purchase of article to subscribed users (multiple subscription
   plans).
 * I’ve seen that a meta_data key named **pms-purchase-restrict-subscription-plan**
   with value of the **subscription plan id** is set to the product.
 * With the old product editor it work but it need to be done product by product
 * When I activate the new product editor
 * I see that in custom field
 * But if I try to change a value it’s not possible because the name of the meta_data
   is not unique
 * When I want to add multiple time the pms-purchase-restrict-subscription-plan 
   with the api it’s not possible too.
 * My question is : How can I create a product with api and restrict the purchase
   of it to multiple subscription plans ?
    -  This topic was modified 1 year, 11 months ago by [kosmic69](https://wordpress.org/support/users/kosmic69/).
    -  This topic was modified 1 year, 11 months ago by [kosmic69](https://wordpress.org/support/users/kosmic69/).

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Support [Madalina Ruzsa](https://wordpress.org/support/users/madalinaruzsa/)
 * (@madalinaruzsa)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/buy-restriction-problem/#post-17798225)
 * Could you please provide more details about how WooCommerce API works in this
   case? A link or any additional information on what you are using to insert these
   items would be helpful.
 *  Thread Starter [kosmic69](https://wordpress.org/support/users/kosmic69/)
 * (@kosmic69)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/buy-restriction-problem/#post-17798644)
 * hi [@madalinaruzsa](https://wordpress.org/support/users/madalinaruzsa/),
 * `{
   "name": "product 1","meta_data": [{"key": "pms-purchase-restrict-subscription-
   plan","value": "200"},{"key": "pms-purchase-restrict-subscription-plan","value":"
   300"}]}
 * If I post this body it will just create the product with the value “300” for “
   pms-purchase-restrict-subscription-plan” and forget “200”. It register only the
   last occurence.
    -  This reply was modified 1 year, 11 months ago by [kosmic69](https://wordpress.org/support/users/kosmic69/).
    -  This reply was modified 1 year, 11 months ago by [kosmic69](https://wordpress.org/support/users/kosmic69/).
 *  Plugin Author [Georgian Cocora](https://wordpress.org/support/users/raster02/)
 * (@raster02)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/buy-restriction-problem/#post-17800463)
 * Hello [@kosmic69](https://wordpress.org/support/users/kosmic69/),
 * You need to contact whatever you are using to insert those products and explain
   this problem to them. The way we store these settings is normal for WordPress,
   you can have multiple meta keys with different values.
 * Unless we completely rework this system, we can’t help you here and this is not
   really an option for us to do.
 * Regards.
 *  Thread Starter [kosmic69](https://wordpress.org/support/users/kosmic69/)
 * (@kosmic69)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/buy-restriction-problem/#post-17808242)
 * Hi [@raster02](https://wordpress.org/support/users/raster02/)
 * I’m using the official woocommerce api for this purpose ([https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-product](https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-product)).
 * Do you want to say that woocommerce has to change the core to adapt them to your
   plugin ?
 * Another solution is to bulk update the pms-purchase-restrict-subscription-plan
   meta key in the UI or preset a default settings for all new products.
 * Select multiple checkbox within the product edit page for each product seems 
   to be timelost for my purposes.
 * What do you think ?
 * Thank you
 *  Thread Starter [kosmic69](https://wordpress.org/support/users/kosmic69/)
 * (@kosmic69)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/buy-restriction-problem/#post-17828475)
 * Hi [@raster02](https://wordpress.org/support/users/raster02/),
 * I have purchased the plugin and see that I can use global content restriction
   for my purpose but the problem with this addon is that the product is also blocked
   to be view and not only to be sold.
 * Is it possible to have this kind of settings just for restrict buying ?
 *  Plugin Author [Georgian Cocora](https://wordpress.org/support/users/raster02/)
 * (@raster02)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/buy-restriction-problem/#post-17829377)
 * Hello [@kosmic69](https://wordpress.org/support/users/kosmic69/),
 * I apologize for the late reply, I was away for a bit.
 * At the moment you can’t configure purchasing settings through this add-on, but
   we would like to add this feature as well. Please open a ticket on our website
   for further information about the paid version, these forums are only for our
   free users.
 * All I was saying about the API question is that in WordPress you can use the 
   same meta name for multiple values, but I don’t know why you can’t with this 
   API. Maybe they just overlooked this or maybe they have their own reason.
 * Regards.
 *  Thread Starter [kosmic69](https://wordpress.org/support/users/kosmic69/)
 * (@kosmic69)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/buy-restriction-problem/#post-17829431)
 * [@raster02](https://wordpress.org/support/users/raster02/) thank you for your
   answer.
 * I’ve made a ticket
 * WordPress seems to have overlooked this because even in the new (beta) interface
   it’s not possible to set 2 times the same meta_data key for a simple product.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Buy restriction problem’ is closed to new replies.

 * ![](https://ps.w.org/paid-member-subscriptions/assets/icon-256x256.png?rev=2961161)
 * [Paid Membership Subscriptions - Effortless Memberships, Recurring Payments & Content Restriction](https://wordpress.org/plugins/paid-member-subscriptions/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/paid-member-subscriptions/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/paid-member-subscriptions/)
 * [Active Topics](https://wordpress.org/support/plugin/paid-member-subscriptions/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/paid-member-subscriptions/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/paid-member-subscriptions/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [kosmic69](https://wordpress.org/support/users/kosmic69/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/buy-restriction-problem/#post-17829431)
 * Status: resolved