I hope that someone may know the answer or guide me in the right direction on this.

I have been looking unsuccessfully at how to create dynamic pricing on woo commerce plugin for wordpress. (example shown is a simple form to update the pricing by user input, but will eventually be a price created from an uploaded file)
Being Specific to user/session

$getcost= $_POST['cost'];
echo "<form action="#" method="POST"><input type="text" name="cost"><button type="submit">Price me</button>";
global $post, $woocommerce;
    $post_id = $post->ID;
    if($post_id == '34'){
$customPrice= $getcost;

Using the update post meta i can change the price, but this changes it for everyone.

update_post_meta($post_id,'_price', $customPrice);

I am just looking to change so it only for the person using it, perhaps based on the session, or to users basket(shopping cart)
Would be great to hear from anyone who has a way round this.
Thank you in advance for being you (AKA “Great”)

Read more here: Woo Commerce hook for updating a price only for the current user. PHP


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , , , ,

Wordpress related questions and answers: