Untitled
add_shortcode('save_list_button', function(){ ob_start(); // should never appear to a guest user + check setting if ( is_user_logged_in() && ( 1 === intval( get_option( 'smuac_enable_shopping_lists_setting', 1 ) ) ) ) { // should not appear if user has a dynamic rule replace prices with quote $user_id = get_current_user_id(); $account_type = get_user_meta( $user_id, 'smuac_account_type', true ); if ( 'multiaccount' === $account_type ) { // for all intents and purposes set current user as the multiaccount parent $parent_user_id = get_user_meta( $user_id, 'smuac_account_parent', true ); $user_id = $parent_user_id; } if ( 'yes' !== get_transient( 'smuac_replace_prices_quote_user_' . $user_id ) ) { ?> <button type="button" class="smuac_add_cart_to_shopping_list_button button"> <?php esc_html_e( 'Save as shopping list', 'smuac' ); ?> </button> <?php } } return ob_get_clean(); });
Leave a Comment