Print only the last 3 characters
-
Hi, I added a column on the cart page where I’m displaying the short description of each product.
But I want to display only the last 3 characters of each short description. Can you please help? This is what I made so far. The short description displays but I don’t know exactly how to show only the last 3 characters. I tried several things but they don’t work.
Thank you!
<td class="woocommerce-product-details__short-description" data-title="<?php esc_attr_e( 'Short Description', 'woocommerce' ); ?>"> <?php if ( ! $short_description ) { echo wp_kses_post( apply_filters( 'woocommerce-product-details__short-description', $_product->get_short_description(), $cart_item, $cart_item_key ) . ' ' ); } else { echo wp_kses_post( apply_filters( 'woocommerce-product-details__short-description', sprintf( '<a href="%s">%s</a>', esc_url( $short_description ), $_product->get_short_description() ), $cart_item, $cart_item_key ) ); } ?> </td>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Print only the last 3 characters’ is closed to new replies.