Category Archives: Aurelie

Change comma to dot in Product Information

Need to add “,” instead of “.” on “Product Information” for Høyde and Bredde.

In theretailer-child/woocommerce/single-product/meta.php:

[php]

if ( $attribute[‘is_taxonomy’] ) {

$values = woocommerce_get_product_terms( $product->id, $attribute[‘name’], ‘names’ );
if ($woocommerce->attribute_label( $attribute[‘name’] ) == ‘Bredde (cm)’ ||
$woocommerce->attribute_label( $attribute[‘name’] ) == ‘Høyde (cm)’ ){
echo apply_filters( ‘woocommerce_attribute’, wpautop( str_replace (".", ",", wptexturize( implode( ”, $values ) ) ) ), $attribute, $values );
}
else echo apply_filters( ‘woocommerce_attribute’, wpautop( wptexturize( implode( ‘, ‘, $values ) ) ), $attribute, $values );
//echo apply_filters( ‘woocommerce_attribute’, wpautop( wptexturize( implode( ‘, ‘, $values ) ) ), $attribute, $values );

} else {
[/php]

 

 

And in product’s admin for those values I use “.” that gets replaced by “,” on front end

 

Hide stock quantity and replace the text with another

Must hide quantity on product pages, so that it only says “På lager” (in stock). Didn’t find any way to change that in admin.

Howto:

in /theretailer-child/woocommerce/single-product/add-to-cart/simple.php I’ve replaced one line with another:

[php]

if ($availability[‘availability’]) :
//echo apply_filters( ‘woocommerce_stock_html’, ‘<p class="stock ‘.$availability[‘class’].’">’.$availability[‘availability’].'</p>’, $availability[‘availability’] );
echo ‘<p class="stock">På lager</p>’;
endif;

[/php]

Voila!

Attribute Visibility checkbox

In theretailer/admin/functions/functions.options.php I’ve added this:

[php]

$of_options[] = array( "name" => "Product Attribute Visibility",
"desc" => "UnCheck to hide the Attribute Visibility in Product Page",
"id" => "attribute_visibility",
"std" => 0,
"type" => "checkbox");

[/php]

after the “Login Content” option – it should be displayed in “Shop” tab in admin->Appearance->Theme Options

And in theretailer_child/woocommerce/single-product/meta.php I’ve added an if statement before showing product info (<h2><?php _e( ‘Product Information’, ‘theretailer’ )?></h2>)

[php]

<?php global $theretailer_theme_options;
if($theretailer_theme_options[‘attribute_visibility’]): ?>

[/php]