Home Forums WoodMart support forum The Product labels not showing

The Product labels not showing

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #519253

    justinavct
    Participant

    Example product link:

    https://rantingj11.sg-host.com/product/moreno-wall-hung-1500mm/?preview_id=23986&preview_nonce=2ad90c6777&_thumbnail_id=24062&preview=true

    Is it possible to make the “new” label show on the category page? Thanks.

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

    Hello,

    Sorro to say your given url is not working. Please share the wp login details i will check and give you a possible solution.

    Best Regards.

    #519601

    justinavct
    Participant

    Here is the login details

    #519777

    Hello,

    There is an issue with the 3rd party plugins. Please deactivate all the 3rd party plugins and activate only theme-required plugins on the site and then check the issue. I am sure your issue will be solved. Then Activate the 3rd party plugins one by one and check which plugin is creating the issue for you.

    Otherwise, if the issue still exists then keep the 3rd party plugins deactivated and let me know so I will check and give you a possible solution.

    Best Regards.

    #520220

    justinavct
    Participant

    I have deactivated the plugin one by one it seems not working.

    #520498

    Hello,

    Please confirm the permission for plugins deactivation, and switch to the parent theme. As soon as we complete the testing of this plugin we will enable it all back, You would better make the full backup of your site.

    Best Regards.

    #520658

    justinavct
    Participant

    Sure, I can give you the permission, I already backup the site

    #520891

    Hello,

    Your issue has been resolved. It is an issue with your child theme. After activating the parent the label is showing fine.

    Here is the product link:
    https://rantingj11.sg-host.com/product/test/

    Best Regards.

    #521805

    justinavct
    Participant

    Hi,

    Thanks for that, but after activating the parent theme, some of the functions.PHP code is not working for the Parent theme.

    It will show this information after I copy and paste the code from the Child theme to the parent theme:

    Fatal error: Cannot redeclare woodmart_child_enqueue_styles() (previously declared in /home/customer/www/rantingj11.sg-host.com/public_html/wp-content/themes/woodmart-child/functions.php:6) in /home/customer/www/rantingj11.sg-host.com/public_html/wp-content/themes/woodmart/functions.php on line 76
    There has been a critical error on this website.”

    Can you help to add a conditional statement of the PHP code? Here is the code that I had added to the child theme before:

    <?php
    /**
    * Enqueue script and styles for child theme
    */
    function woodmart_child_enqueue_styles() {
    wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’, array( ‘woodmart-style’ ), woodmart_get_theme_info( ‘Version’ ) );
    }
    add_action( ‘wp_enqueue_scripts’, ‘woodmart_child_enqueue_styles’, 10010 );

    // function get_variation_id_by_slug($product_id, $variation_slug) {
    // $product = wc_get_product($product_id);

    // if ($product) {
    // $variations = $product->get_available_variations();
    // // print_r($variations);

    // foreach ($variations as $variation) {
    // if ($variation[‘attributes’][‘attribute_pa_cabinet-options’] === $variation_slug) {
    // return $variation[‘variation_id’];
    // }
    // }
    // }

    // return 0; // Return 0 if variation not found
    // }

    // function get_stock_status() {
    // $variation_slug = $_POST[‘variation_id’];
    // $product_id = $_POST[‘product_id’];
    // $variation_id = get_variation_id_by_slug($product_id, $variation_slug);
    // $variation = wc_get_product($variation_id);

    // $stock_quantity = $variation->get_stock_quantity();

    // if ($stock_quantity === 0) {
    // echo ‘outofstock’;
    // } elseif ($stock_quantity <= 10) {
    // echo ‘lowstock’;
    // } else {
    // echo ‘instock’;
    // }

    // die();
    // }

    // add_action(‘wp_ajax_get_stock_status’, ‘get_stock_status’);
    // add_action(‘wp_ajax_nopriv_get_stock_status’, ‘get_stock_status’);

    // * archive page stock label
    function woocommerce_stock_status_archive_loop()
    {
    global $product;

    if ($product->is_type(‘simple’)) {
    if (!$product->is_in_stock()) {
    echo ‘<div class=”product-labels labels-rounded new”><span class=”out-of-stock product-label”>Out of Stock</span></div>’;
    } elseif ($product->is_in_stock() && $product->get_stock_quantity() < 10) {
    echo ‘<div class=”product-labels labels-rounded new”><span class=”out-of-stock product-label”>Low Stock</span></div>’;
    } else if ($product->is_in_stock() && $product->get_stock_quantity() >= 10) {
    echo ‘<div class=”product-labels labels-rounded new”><span class=”out-of-stock product-label”>In Stock</span></div>’;
    }
    }
    }

    // Add stock status to archive pages
    // add_action( ‘woocommerce_before_shop_loop_item’, ‘woocommerce_stock_status_archive_loop’, 10 );

    // * single product page
    function woocommerce_stock_status_single()
    {
    global $product;
    if ($product->is_type(‘simple’)) {
    if (!$product->is_in_stock()) {
    echo ‘<div class=”stock red”>Out of Stock</div>’;
    } elseif ($product->is_in_stock() && $product->get_stock_quantity() < 10) {
    echo ‘<div class=”stock orange”>Low Stock</div>’;
    } else if ($product->is_in_stock() && $product->get_stock_quantity() >= 10) {
    echo ‘<div class=”stock orange”>In Stock</div>’;
    }
    }
    }

    // Add stock status to single pages
    add_action( ‘woocommerce_product_meta_start’, ‘woocommerce_stock_status_single’, 10 );

    // * stock label

    add_action( ‘woocommerce_before_single_variation’, ‘variation_info’ );

    function variation_info() {
    global $product;
    if ( ! $product->is_type( ‘variable’ ) ) return;
    echo ‘<div class=”var_info stock”></div>’;
    wc_enqueue_js( ”
    $(document).on(‘found_variation’, ‘form.cart’, function( event, variation ) {
    $(‘.var_info’).addClass(‘show’);
    $(‘.var_info’).removeClass(‘hide’);
    if(variation.max_qty >= 10){
    $(‘.var_info’).html(‘In Stock’);
    $(‘.var_info’).addClass(‘in-stock’);
    $(‘.var_info’).removeClass(‘low-stock’);
    $(‘.var_info’).removeClass(‘out-of-stock’);
    }
    else if(variation.max_qty < 10 && variation.max_qty > 1 ){
    $(‘.var_info’).html(‘Low Stock’);
    $(‘.var_info’).removeClass(‘in-stock’);
    $(‘.var_info’).addClass(‘low-stock’);
    $(‘.var_info’).removeClass(‘out-of-stock’);
    }else if(variation.max_qty < 1 ){
    $(‘.var_info’).html(‘Out Of Stock’);
    $(‘.var_info’).removeClass(‘in-stock’);
    $(‘.var_info’).removeClass(‘low-stock’);
    $(‘.var_info’).addClass(‘out-of-stock’);
    }
    });
    ” );
    }

    function wooc_extra_register_fields() {?>

    <p class=”form-row form-row-wide”>

    <label for=”reg_billing_phone”><?php _e( ‘Phone’, ‘woocommerce’ ); ?></label>

    <input type=”text” class=”input-text” name=”billing_phone” id=”reg_billing_phone” value=”<?php esc_attr_e( $_POST[‘billing_phone’] ); ?>” />

    </p>

    <p class=”form-row form-row-wide”>

    <label for=”reg_billing_business_name”><?php _e( ‘Business name’, ‘woocommerce’ ); ?><span class=”required”>*</span></label>

    <input type=”text” class=”input-text” name=”billing_business_name” id=”reg_billing_business_name” value=”<?php if ( ! empty( $_POST[‘billing_business_name’] ) ) esc_attr_e( $_POST[‘billing_business_name’] ); ?>” />

    </p>

    <div class=”clear”></div>

    <?php

    }

    add_action( ‘woocommerce_register_form_start’, ‘wooc_extra_register_fields’ );

    #521946

    Hello,

    I regret to inform you that I’m unable to assist with code customizations beyond the scope of our limitations and support policy. Any modifications made to the theme files are undertaken at your own risk, and our support does not extend to addressing issues arising from changes in the theme code.

    Thank you for your comprehension.

    Best Regards.

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