WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
update_post_meta not working? (1 post)

  1. Roy Sivan
    Member
    Posted 1 year ago #

    Hello, I have created function tied in with Gravity Forms where I can adjust pricing by weight, it is for a client that sells jewelry and pricing is based on the day's price per gram (of metal).
    I haven't seen anyone else do this before, so if you know if an example please link me.
    Anyway, I have it all working fine, got all the maths worked out, and after many failed attempts at using the new set_price API function, I went back to using update_post_meta
    at the end of my function I have:
    update_post_meta($post->ID, '_regular_price', $NewPriceM);
    update_post_meta($post->ID, '_sale_price', $NewPrice);
    Where NewPriceM is just NewPrice * 2 (I will change this later)... it saves find in the database, but when I refresh my "store" page, all prices are removed, and I am left with the former sale price. HOWEVER when I go into the WP Admin > Products and click INTo a product.. the prices that I want show up there fine, and save properly when I hit the normal "update" button...
    I looked into what is tied in there and found a few things which I am not sure are relevant (like removing old transients)... let me know, I feel like there is 1 step I am missing here to complete this.

    http://wordpress.org/extend/plugins/woocommerce/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.