Hide Meta Property product:price:amount

#613912
  • Resolved Anonymous
    Rank Math free

    Hi!

    I’m trying to remove meta property product:price:amount at single product page when quantity in the URL parameter is > 1.

    My code:

    //* Remove meta propertys when quantity > 1 *//
    function custom_remove_rank_math_meta_tags() {
    // Get 'quantity' from URL
    $quantity = isset($_GET['quantity']) ? intval($_GET['quantity']) : 1;

    if ($quantity > 1) {
    add_filter( "rank_math/opengraph/product/price/amount", function( $content ) {
    return false;
    });
    }
    }
    add_action('wp', 'custom_remove_rank_math_meta_tags');

    Can you help me?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Anonymous
    Rank Math free

    Solved,

    function custom_remove_rank_math_price_meta() {
        // Obtener el valor del parámetro 'quantity' de la URL
        $quantity = isset($_GET['quantity']) ? intval($_GET['quantity']) : 1;
        
        if ($quantity > 1) {
            add_filter('rank_math/woocommerce/og_price', '__return_false');
        }
    }
    add_action('wp', 'custom_remove_rank_math_price_meta');

    Thank you

    Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    We are glad that you have already managed to resolve this issue and appreciate you for sharing the solution here.

    If you have any other concerns, please don’t hesitate to contact us anytime to assist you further.

    Looking forward to helping you.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

The ticket ‘Hide Meta Property product:price:amount’ is closed to new replies.