Home Forums WoodMart – Premium Template Need help with product label.

Need help with product label.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #126380

    raugul
    Participant

    Hello!

    Please help to install WCFM badges next to woodmart product label.
    I can not understand, and the developers of WCFM, do not help me for a month.

    I really need your help.

    Thank you!

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

    Elise Noromit
    Keymaster

    Hello,

    Most likely the plugin is not compatible with our theme. Try to find another one. Our support does not cover fixing the third parties plugins.

    Best Regards

    #126409

    raugul
    Participant

    The plugin is supported,but I can not figure out where to insert this code.
    Through exploring the element in the browser, I move this code and get what I need.
    I don’t know where to insert it (in which php file) to apply these changes.
    I understand that you don’t have to make websites.
    Just a little request for help.

    #126411

    raugul
    Participant

    Code on screenshot

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

    raugul
    Participant

    I found only this in the theme files:

    if( ! function_exists( 'woodmart_product_label' ) ) {
    	function woodmart_product_label() {
    		global $product;
    
    		$output = array();
    
    		$product_attributes = woodmart_get_product_attributes_label();
    		$percentage_label = woodmart_get_opt( 'percentage_label' );
    
    		if ( $product->is_on_sale() ) {
    
    			$percentage = '';
    
    			if ( $product->get_type() == 'variable' && $percentage_label ) {
    
    				$available_variations = $product->get_variation_prices();
    				$max_percentage = 0;
    
    				foreach( $available_variations['regular_price'] as $key => $regular_price ) {
    					$sale_price = $available_variations['sale_price'][$key];
    
    					if ( $sale_price < $regular_price ) {
    						$percentage = round( ( ( $regular_price - $sale_price ) / $regular_price ) * 100 );
    
    						if ( $percentage > $max_percentage ) {
    							$max_percentage = $percentage;
    						}
    					}
    				}
    
    				$percentage = $max_percentage;
    			} elseif ( ( $product->get_type() == 'simple' || $product->get_type() == 'external' ) && $percentage_label ) {
    				$percentage = round( ( ( $product->get_regular_price() - $product->get_sale_price() ) / $product->get_regular_price() ) * 100 );
    			}
    
    			if ( $percentage ) {
    				$output[] = '<span class="onsale product-label">-' . $percentage . '%' . '</span>';
    			}else{
    				$output[] = '<span class="onsale product-label">' . esc_html__( 'Sale', 'woodmart' ) . '</span>';
    			}
    		}
    		
    		if( !$product->is_in_stock() && !is_product() ){
    			$output[] = '<span class="out-of-stock product-label">' . esc_html__( 'Sold out', 'woodmart' ) . '</span>';
    		}
    
    		if ( $product->is_featured() && woodmart_get_opt( 'hot_label' ) ) {
    			$output[] = '<span class="featured product-label">' . esc_html__( 'Hot', 'woodmart' ) . '</span>';
    		}
    		
    		if ( get_post_meta( get_the_ID(), '_woodmart_new_label', true ) && woodmart_get_opt( 'new_label' ) ) {
    			$output[] = '<span class="new product-label">' . esc_html__( 'New', 'woodmart' ) . '</span>';
    		}
    		
    		if ( $product_attributes ) {
    			foreach ( $product_attributes as $attribute ) {
    				$output[] = $attribute;
    			}
    		}
    		
    		if ( $output ) {
    			echo '<div class="product-labels labels-' . woodmart_get_opt( 'label_shape' ) . '">' . implode( '', $output ) . '</div>';
    		}
    	}
    }
    add_filter( 'woocommerce_sale_flash', 'woodmart_product_label', 10 );

    But how to insert vendor badges don’t know.

    #126445

    Elise Noromit
    Keymaster

    Hello,

    The plugins support should know that. We do not have any instructions and do not know where to insert this code and how it works.

    Best Regards

Tagged: 

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