Override Prices in Woocommerce - by dmkc

This topic has 2 replies, 2 voices, and was last updated 9 years, 1 months ago ago by Robert Hall

  • Avatar: dmkc
    dmkc
    Participant
    October 8, 2015 at 11:51

    I’m trying to override the prices in Woocommerce, and it should work using the following code placed in the functions file:

    function return_custom_price($price, $product) {
    global $post, $blog_id;
    $price = get_post_meta($post->ID, ‘_regular_price’);
    $post_id = $post->ID;
    $price = 1.23;
    return $price;
    }
    add_filter(‘woocommerce_template_single_price’, ‘return_custom_price’, 10, 2);

    This should return all prices as 1.23, however it’s not working. It’s as if the single product page isn’t recognising the override. Can you help me with why this might happen in your theme?

    1 Answer
    Avatar: Robert Hall
    Robert Hall
    Support staff
    October 8, 2015 at 12:38

    Hello,

    Please provide us with wp-admin and FTP credentials in Private Content.

    Regards,
    Robert Hall.

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.