Add a restriction through PHP
-
Hello,
First of all, THANKS. I’ve been struggling with a lot of plugins, including multivendors ones, to achieve very simple functionalities. It was like hell.
Eventually, all I have to do is letting visitors send posts, and put a price on those posts. Easy, but it couldn’t be that easy without your plugin. Thanks.Now, I’m still stuck to the PHP part.
When visitors send a new post on my plugin, I want to put a fixed price to access it. I already have a PHP custom code that runs every time that happens.
I have a template product for that, I duplicate it, but I don’t manage to create a restriction with the duplicated product and the post that the visitor just sent.My code looks like that, it’s total improvisation but it should show in some way what I’m trying to achieve
$wc_adp = new WC_Admin_Duplicate_Product; $dproduct = $wc_adp->product_duplicate( wc_get_product( '2726' ) ); # TEMPLATE one # NOT WORKING RIGHT NOW # using this new product with /sitewp/wp-content/plugins/woocommerce-pay-per-post/public/class-woocommerce-pay-per-post-restrict-content.php $restrict = new Woocommerce_Pay_Per_Post_Restrict_Content($post_id); array_push($restrict->product_ids, $dproduct->id);
What should I do? Any idea?
Thank you!
The page I need help with: [log in to see the link]
- The topic ‘Add a restriction through PHP’ is closed to new replies.