Home Forums WoodMart support forum I cannot change the stock availability text in the product catalog

I cannot change the stock availability text in the product catalog

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #591595

    ssxwebmaster
    Participant

    Can you please help me out here?
    i am trying to change the stock status text in the product catalog page but i cannot find the hook needed to do it.

    i have the following code snippet below that works just fine in the product page…. but i can’t for the life of me figure out how to change the text in the catalog page….

    here is the snippet

    add_filter( ‘woocommerce_get_availability_text’, ‘custom_get_availability_text’, 100, 2 );
    function custom_get_availability_text( $availability, $product ) {
    if ( $product->get_stock_quantity() <= 0 ) {
    $custom_availability = $product->get_attribute( ‘prime-custom-availability’ );

    if ( empty( $custom_availability ) ) {
    $availability = ‘Not available’;
    } else {
    $availability = $custom_availability;
    }
    }
    else {
    $availability = ‘Express Delivery’;
    }

    return $availability;
    }

    #591666

    Hello,

    Please use the Loco translate plugin on your site. After installing the plugin please Navigate to Loco >> Themes >> Woodmart >> Edit the translation which you are using for the site >> Click the Sync button >> Find the words and add the translation for them and save it.

    Also, please Navigate to Loco >> Plugins >> Woocommerce >> Edit the translation which you are using for the site >> Click the Sync button >> Find the words and add the translation for them and save it.

    Also, please Navigate to Loco >> Plugins >> Woodmart-Core >> Edit the translation which you are using for the site >> Click the Sync button >> Find the words and add the translation for them and save it.

    https://wordpress.org/plugins/loco-translate/

    Note:
    1. Custom (recommended)
    2. This is Loco’s protected folder under “wp-content/languages/loco/” which is safe from automatic updates and provides priority over the above locations.
    https://localise.biz/wordpress/plugin/manual/msginit?utm_medium=plugin&utm_campaign=wp&utm_source=admin&utm_content=plugin-msginit#order
    If this folder doesn’t exist you may need to create it and ensure it has the correct permissions.
    https://localise.biz/wordpress/plugin/manual/filesystem

    If the issue still exists then please send me the WP admin login details of your site so I will check and solve the issue for you.

    For more information please read the theme documentation here:
    https://xtemos.com/docs-topic/translate-woodmart-theme-with-loco-translate/

    Best Regards.

    #591704

    ssxwebmaster
    Participant

    did you read my post?

    Loco has NOTHING to do with what i want. i don’t want a translation… i want a custom code.
    i need to change through a code snippet, what it says there based on a custom availability field.
    please read my code and tell me why your products archive in product catalog, doesn’t use the “woocommerce_get_availability_text” hook.

    #591741

    Hello,

    Please send me the WP admin login details of your site so I will check and solve the issue for you.

    Best Regards.

    #591757

    ssxwebmaster
    Participant

    Aizaz you don’t need WP admin details, you can test what i am saying with your demos

    here…
    https://woodmart.xtemos.com/mega-electronics/product-category/laptops-tablets-pcs/

    check the attached screenshot and the url of your demo and you will understand what i am talking about.

    i want my code snippet (the one i provided above) to be able to change the text from the “In Stock” field to my custom availability.

    i know that the snippet works just fine because if i use it in the product page which uses the hook “woocommerce_get_availability_text”, it works just fine.

    it doesn’t work in your product catalog

    Attachments:
    You must be logged in to view attached files.
    #592017

    Hello,

    THere is no need to use the snippet code to change the text or words in the theme. You can easily change it everywhere on the site by using a simple Translation plugin.

    If you want to use the code then it requires customizations and this is beyond our limitations and support policy.

    Regards.
    Xtemos Studios

    #592127

    ssxwebmaster
    Participant

    Aizaz,

    i don’t know how more specific i can be.
    i don’t want to TRANSLATE the status…
    i want to manipulate it EXACTLY like i did at the product page. The code above works! but only in the product page.

    Manipulate by change the text based on conditions coming from a woocommerce HOOK.

    have you spend 1 minute reading carefully the code snippet i gave you above? have you tried to actually understand what i am saying above?

    is there an actual support department or am i stuck with just you? because clearly there is a communication issue.
    you are playing dumb and now you threw the “beyond our limitations” card. and it has taken us 3 days!

    i am asking a very specific question that requires an answer from your development team.

    #592476

    Hello,

    Unfortunately, this hook does not work with our stock status; this was done intentionally and cannot be fixed.

    However, if you need to modify it, you can copy the woodmart_stock_status_after_title() function from inc/integrations/woocommerce/template-tags.php at line 2482 into your child theme and customize it according to your needs.

    Best Regards.

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