Home Forums Plugin Support WP User Frontend (Free Version) Problems with prices in WooCommerce

This topic is: resolved

This topic contains 12 replies, has 3 voices, and was last updated by  bigtom 5 years ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #20418

    bigtom
    Member
    Post count: 74

    So I am having issues with products when I use a _sale_price. I referenced the topic here.

    I added the supplied code to the functions.php to assign the value of _price to _regular_price. This works. However the sale price will not show unless I go the the product in admin and update without changing anything. Is there some other missing mete key for sale products?

    #20423

    bigtom
    Member
    Post count: 74

    I think I have figured this out I just need to work a way to keep _price updated with the _sale_price after _price is set to _regular_price and only if it is on sale. I am not sure how to write that function.

    Set _regular_price to _price
    If _sale_price has value
    Set _price to _sale_price

    Something like this should be a solid fix for the price display interaction with WPUF.

    #20425

    bigtom
    Member
    Post count: 74

    Edit

    #20666

    bigtom
    Member
    Post count: 74

    No help with this?

    #20669

    Mahi
    Member
    Post count: 1555

    you will not be able to manage it with free version. Cause, free version has cf_ prefix at first on it's each meta fields by default.

    #20670

    bigtom
    Member
    Post count: 74

    I am not using the free version, but I cannot post in the Pro section because of different email I think. None of my meta fields are prefixed with cf_.

    The regular price is working using the code you supplied in a different post, but the sale price needs to be sent to _price only when there is a _sale_price value and this cannot affect the regular price.

    Can you help with this?

    #20673

    bigtom
    Member
    Post count: 74

    I am also wondering if there is a way to set multiple users to see the same products on the dashboard with different user IDs. Maybe setting a hidden field to make author “master” and use [wpuf_dashboard author=master].

    #20827

    bigtom
    Member
    Post count: 74

    Still trying to sort this sale price situation out. Any advice would be appreciated.

    #21940

    Sk
    Moderator
    Post count: 371

    Hello bigtom,

    sorry for late response. maybe you have done something like this,
    Set _regular_price to _price
    If _sale_price has value
    Set _price to _sale_price

    but you need to do like this,
    Set _regular_price to _price
    If _sale_price has value
    Set _sale_price to _price

    Thank you.

    #21961

    bigtom
    Member
    Post count: 74

    Thanks I will give this a try.

    Tom

    #21979

    bigtom
    Member
    Post count: 74

    Hello,

    I am not sure how to include this in the current function I have.

    function wpufe_update_post_price( $post_id ) {
    $price = get_post_meta( $post_id, ‘_price', true );

    update_post_meta( $post_id, ‘_regular_price', $price );
    }

    It seems the example you gave sets the _regular_price to _sale_price
    through _price. Maybe it does not make sense but it works?

    Thanks,

    Tom

    #21996

    Sk
    Moderator
    Post count: 371

    please don't set “_regular_price” to “_sale_price
    but set “_sale_price” to “_price” if there have “_sale_price“.

    change the function like this:

    function wpufe_update_post_price( $post_id ) {
    
        $regular_price = get_post_meta( $post_id, ‘_regular_price’, true );
        $sale_price = get_post_meta( $post_id, ‘_sale_price’, true );
    
        update_post_meta( $post_id, ‘_price’, $regular_price );
    
        if ( !empty( $sale_price ) ) {
    
            update_post_meta( $post_id, ‘_price’, $sale_price );
    
        }
    
    }

    Hope this will work.
    Thank you.

    #22002

    bigtom
    Member
    Post count: 74

    Thank you,

    The email had some syntax issues with the apostropes and the font. Once
    I got that fixed it works so far as I can tell. I appreciate the support.

    Tom

Viewing 13 posts - 1 through 13 (of 13 total)

The topic ‘Problems with prices in WooCommerce’ is closed to new replies.