• Resolved kosmic69

    (@kosmic69)


    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 6 months ago by kosmic69.
    • This topic was modified 6 months ago by kosmic69.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support madalinaruzsa

    (@madalinaruzsa)

    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

    (@kosmic69)

    hi @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 5 months, 4 weeks ago by kosmic69.
    • This reply was modified 5 months, 4 weeks ago by kosmic69.
    Plugin Author Georgian Cocora

    (@raster02)

    Hello @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

    (@kosmic69)

    Hi @raster02

    I’m using the official woocommerce api for this purpose (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

    (@kosmic69)

    Hi @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

    (@raster02)

    Hello @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

    (@kosmic69)

    @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)
  • You must be logged in to reply to this topic.