Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Hook – PHP

  • Hi Team,

    I would like to execute the PHP code below on the WooCommerce product and category pages and exclude this PHP code from the shopping cart.

    When performing this php within the hook, the site crashes. Can you maybe advice, please?

    Settings:
    Hook: woocommere_before_main_content
    Location: Products & Product Category
    Exclude: page: cart
    Php:

    <?php
    function codeAstrology_remove_wc_currency_symbols( $currency_symbol, $currency ) {
    $currency_symbol = ”;
    return $currency_symbol;
    }
    add_filter(‘woocommerce_currency_symbol’, ‘codeAstrology_remove_wc_currency_symbols’, 10, 2);

  • Hi there,

    The hook element can only accommodate PHP code that run on the front end, and output content on the front end.

    This kind of code runs in backend before the page load, it needs to be added to your child theme’s functions.php or a plugin like Code snippets.

  • Okay, clear thanks!

  • You are welcome   🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.