Skip to content

Instantly share code, notes, and snippets.

@growdev
Created June 4, 2020 16:25
Show Gist options
  • Save growdev/09fe95ee7985cee631105db92fa52909 to your computer and use it in GitHub Desktop.
Save growdev/09fe95ee7985cee631105db92fa52909 to your computer and use it in GitHub Desktop.
Toolbox - Remove input quantity from /my-account/subscriptions page
<?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() ) . ' &times; ' . 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