Created
June 4, 2020 16:25
-
-
Save growdev/09fe95ee7985cee631105db92fa52909 to your computer and use it in GitHub Desktop.
Toolbox - Remove input quantity from /my-account/subscriptions page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Remove the list of products in a subscription with the quantity input | |
remove_action( 'woocommerce_my_subscriptions_after_subscription_id', 'Javorszky\Toolbox\add_list_of_items' ); | |
// Re-add the list of products without the quantity input. | |
add_action( 'woocommerce_my_subscriptions_after_subscription_id', 'sp_add_list_of_items' ); | |
function sp_add_list_of_items( $subscription ) { | |
echo '<ul>'; | |
foreach ( $subscription->get_items() as $item_id => $item ) { | |
echo '<li>' . wp_kses_post( $item->get_name() ) . ' × ' . esc_attr( $item->get_quantity() ) . '</li>'; | |
} | |
echo '</ul>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment