HiΒ @jakariaahmed118477,
Thanks for writing to us! I apologize for the delay in getting back to you. I am happy to help out here. π
You can check for specific a specific attribute by checking the $attribute->get_name() ( the $attributes from the code in the post should really read $attribute).
I hope that’s helpful!
Tamara π
where i need to add this “$attribute->get_name()” code? Should i add this code after my applied code?
Hi @jakariaahmed118477,
Sure, I’m happy to provide some tips here. You can update the code like so:
function skyverge_change_attribute_list_display( $output, $attributes, $values ) {
if ( 'Specific Attribute Name' === $attribute->get_name() ) {
$output = wpautop( wptexturize( implode( β<br />β, $values ) ) );
}
return $output;
}
add_filter( 'woocommerce_attribute', 'skyverge_change_attribute_list_display', 10, 3 );
Here you would replace Specific Attribute Name with the name of your attribute such as Color or Size.
I hope that’s helpful π
Stay safe,
Tamara
When i add this code on my functions.php, then shows “There has been a critical error on your website.”.
How i can do it? Do you have any other code?
Hi @jakariaahmed118477,
Sorry about that, seems like two characters got mangled as I copy/pasted the code from your original sample. Please try the following:
function skyverge_change_attribute_list_display( $output, $attributes, $values ) {
if ( 'Specific Attribute Name' === $attribute->get_name() ) {
$output = wpautop( wptexturize( implode( '<br />', $values ) ) );
}
return $output;
}
add_filter( 'woocommerce_attribute', 'skyverge_change_attribute_list_display', 10, 3 );
Thanks
I tried this code also, again it shows the same message.
@jakariaahmed118477 Do you still have the original code in place or did you replace it with the above?
I was only replace with attribute name.
Hi @jakariaahmed118477,
Would you please check the email that was sent to your WordPress admin email for the full error message? Alternatively, you can also enable WP Debug Mode to see the errors directly or in a log file.
Please be sure to remove any identifying information from the error logs if you want to paste them here π
Thanks,
Tamara