diff --git a/woocommerce-checkout-add-ons/conditionally-hide-add-ons.php b/woocommerce-checkout-add-ons/conditionally-hide-add-ons.php index 7edcca9..a211fc0 100644 --- a/woocommerce-checkout-add-ons/conditionally-hide-add-ons.php +++ b/woocommerce-checkout-add-ons/conditionally-hide-add-ons.php @@ -6,22 +6,22 @@ */ function sv_wc_checkout_add_ons_conditionally_show_gift_add_on() { - wc_enqueue_js( " - $( 'input[name=ship_to_different_address]' ).change( function () { + wc_enqueue_js( " + $( 'input[name=ship_to_different_address]' ).change( function () { - if ( $( this ).is( ':checked' ) ) { + if ( $( this ).is( ':checked' ) ) { + + // show the gift checkout add-on -- replace '2' with the id of your add-on + $( '#wc_checkout_add_ons_2_field' ).show(); - // show the gift checkout add-on -- replace '2' with the id of your add-on - $( '#wc_checkout_add_ons_2_field' ).show(); + } else { - } else { + // hide the gift checkout add-on -- replace '2' with the id of your add-on + $( '#wc_checkout_add_ons_2_field' ).hide(); - // hide the gift checkout add-on -- replace '2' with the id of your add-on - $( '#wc_checkout_add_ons_2_field' ).hide(); + } - } - - } ).change(); - " ); + } ).change(); + " ); } -add_action( 'wp_enqueue_scripts', 'sv_wc_checkout_add_ons_conditionally_show_gift_add_on' ); \ No newline at end of file +add_action( 'wp_enqueue_scripts', 'sv_wc_checkout_add_ons_conditionally_show_gift_add_on' ); diff --git a/woocommerce-customer-order-csv-export/add-item-meta-to-order-export.php b/woocommerce-customer-order-csv-export/add-item-meta-to-order-export.php index d91c2ef..ee4db0d 100644 --- a/woocommerce-customer-order-csv-export/add-item-meta-to-order-export.php +++ b/woocommerce-customer-order-csv-export/add-item-meta-to-order-export.php @@ -37,7 +37,7 @@ function sv_wc_csv_export_add_weight_to_line_item( $line_item, $item, $product, * Add `item_weight` column to the default and custom formats * * @param array $column_headers the original column headers - * @param WC_Customer_Order_CSV_Export_Generator $csv_generator the generator instance + * @param \WC_Customer_Order_CSV_Export_Generator $csv_generator the generator instance * @return array - the updated column headers */ function sv_wc_csv_export_modify_column_headers_item_price( $column_headers, $csv_generator ) { @@ -53,7 +53,6 @@ function sv_wc_csv_export_modify_column_headers_item_price( $column_headers, $cs // add the item_price after the SKU column if ( 'item_sku' === $key ) { $new_headers['item_weight'] = 'item_weight'; - } } diff --git a/woocommerce-customer-order-csv-export/add-product-attributes-to-one-row-per-item-order-export.php b/woocommerce-customer-order-csv-export/add-product-attributes-to-one-row-per-item-order-export.php index 088b90f..87ba934 100644 --- a/woocommerce-customer-order-csv-export/add-product-attributes-to-one-row-per-item-order-export.php +++ b/woocommerce-customer-order-csv-export/add-product-attributes-to-one-row-per-item-order-export.php @@ -42,7 +42,6 @@ function sv_wc_csv_export_add_product_attributes_column( $headers ) { function sv_wc_csv_export_add_product_to_order_line_item( $line_item, $_, $product ) { $line_item['product'] = $product; - return $line_item; } add_filter( 'wc_customer_order_csv_export_order_line_item', 'sv_wc_csv_export_add_product_to_order_line_item', 10, 3 ); diff --git a/woocommerce-customer-order-csv-export/add-username-role-to-customer-export.php b/woocommerce-customer-order-csv-export/add-username-role-to-customer-export.php index 97a302a..6de8948 100644 --- a/woocommerce-customer-order-csv-export/add-username-role-to-customer-export.php +++ b/woocommerce-customer-order-csv-export/add-username-role-to-customer-export.php @@ -31,7 +31,6 @@ function sv_wc_customer_csv_export_column_headers( $column_headers ) { // Adds new column after 'last_name' column if ( 'last_name' === $key ) { $new_headers['role'] = 'role'; - } } diff --git a/woocommerce-measurement-price-calculator/add-content-if-calculator-enabled.php b/woocommerce-measurement-price-calculator/add-content-if-calculator-enabled.php index 2f2db71..d0642a7 100644 --- a/woocommerce-measurement-price-calculator/add-content-if-calculator-enabled.php +++ b/woocommerce-measurement-price-calculator/add-content-if-calculator-enabled.php @@ -4,13 +4,13 @@ * Example: Add a heading above the calculator section */ function sv_wc_measurement_price_calculator_heading() { + global $product; // bail if MPC isn't active if ( ! class_exists( 'WC_Price_Calculator_Product' ) ) { return; } - global $product; $measurement = WC_Price_Calculator_Product::calculator_enabled( $product ); // if the calculator is enabled, add the heading diff --git a/woocommerce-measurement-price-calculator/add-min-max-input-values.php b/woocommerce-measurement-price-calculator/add-min-max-input-values.php index b87a3d5..591d3b2 100644 --- a/woocommerce-measurement-price-calculator/add-min-max-input-values.php +++ b/woocommerce-measurement-price-calculator/add-min-max-input-values.php @@ -7,14 +7,13 @@ * requires HTML5 support */ function sv_wc_measurement_price_calculator_input_min_max() { + global $product; // bail unless we're on a product page and MPC is active if ( ! ( is_product() && class_exists( 'WC_Price_Calculator_Product' ) ) ) { return; } - global $product; - // bail unless the calculator is enabled for this product, this is also why we hook into the footer scripts // since this isn't available immediately at page load if ( ! WC_Price_Calculator_Product::calculator_enabled( $product ) ) { @@ -31,10 +30,10 @@ function sv_wc_measurement_price_calculator_input_min_max() { /**------------------------------------------------------------ - Note: if you run into "Error: type property can't be changed", - then you can also use the jQuery "clone" function, + Note: if you run into "Error: type property can't be changed", + then you can also use the jQuery "clone" function, then destroy the text field once it's replaced. - + Example: $('#length_needed').clone().attr({ type: 'number', min: '.1', max: '24', step: '.1' }).insertAfter('#length_needed').prev().remove(); -------------------------------------------------------------**/ \ No newline at end of file +------------------------------------------------------------**/ diff --git a/woocommerce-measurement-price-calculator/calculated-weight-shipstation-integration.php b/woocommerce-measurement-price-calculator/calculated-weight-shipstation-integration.php index a5a4e0f..e0ec3f0 100644 --- a/woocommerce-measurement-price-calculator/calculated-weight-shipstation-integration.php +++ b/woocommerce-measurement-price-calculator/calculated-weight-shipstation-integration.php @@ -5,6 +5,7 @@ * the correct weight via the WooCommerce ShipStation Integration */ + /** * Filter the product's weight only when the WooCommerce ShipStation API is loaded. * This ensures that the `WC_Order::woocommerce_get_product_from_item()` method diff --git a/woocommerce-measurement-price-calculator/change-measurement-precision.php b/woocommerce-measurement-price-calculator/change-measurement-precision.php index f79353a..46ffb77 100644 --- a/woocommerce-measurement-price-calculator/change-measurement-precision.php +++ b/woocommerce-measurement-price-calculator/change-measurement-precision.php @@ -10,11 +10,11 @@ * @return int The number of decimal places */ function sv_wc_measurement_price_calculator_change_measurement_precision() { - return 2; } add_filter( 'wc_measurement_price_calculator_measurement_precision', 'sv_wc_measurement_price_calculator_change_measurement_precision' ); + /** * Round the Measurement Price Calculator total measurement on the cart page to * 2 decimal places. diff --git a/woocommerce-measurement-price-calculator/hide-unit-price-on-product-pages.php b/woocommerce-measurement-price-calculator/hide-unit-price-on-product-pages.php index a198898..b786855 100644 --- a/woocommerce-measurement-price-calculator/hide-unit-price-on-product-pages.php +++ b/woocommerce-measurement-price-calculator/hide-unit-price-on-product-pages.php @@ -5,13 +5,13 @@ * for Measurement Calculator products */ function sv_wc_measurement_price_calculator_hide_unit_price() { + global $product; // bail if the calculator isn't active or this isn't a product page if ( ! class_exists( 'WC_Price_Calculator_Product' ) || ! is_product() ) { return; } - global $product; $measurement = WC_Price_Calculator_Product::calculator_enabled( $product ); // if the calculator is enabled, hide unit price diff --git a/woocommerce-memberships/admin/only-grant-access-for-completed-orders.php b/woocommerce-memberships/admin/only-grant-access-for-completed-orders.php index 58a7dd6..08099db 100644 --- a/woocommerce-memberships/admin/only-grant-access-for-completed-orders.php +++ b/woocommerce-memberships/admin/only-grant-access-for-completed-orders.php @@ -10,6 +10,5 @@ function sv_wc_memberships_remove_processing_access() { if ( function_exists( 'wc_memberships' ) ) { remove_action( 'woocommerce_order_status_processing', array( wc_memberships(), 'grant_membership_access' ), 11 ); } - } add_action( 'init', 'sv_wc_memberships_remove_processing_access' ); diff --git a/woocommerce-memberships/create-membership-for-user-registration.php b/woocommerce-memberships/create-membership-for-user-registration.php index 4846823..d1303fc 100644 --- a/woocommerce-memberships/create-membership-for-user-registration.php +++ b/woocommerce-memberships/create-membership-for-user-registration.php @@ -10,22 +10,22 @@ function sv_wc_memberships_user_membership_at_registration( $user_id ) { // bail if Memberships isn't active - if ( ! function_exists( 'wc_memberships' ) ) { - return; - } + if ( ! function_exists( 'wc_memberships' ) ) { + return; + } - $args = array( - // Enter the ID (post ID) of the plan to grant at registration - 'plan_id' => 253, - 'user_id' => $user_id, - ); + $args = array( + // Enter the ID (post ID) of the plan to grant at registration + 'plan_id' => 253, + 'user_id' => $user_id, + ); - // magic! - wc_memberships_create_user_membership( $args ); + // magic! + wc_memberships_create_user_membership( $args ); - // Optional: get the new membership and add a note so we know how this was registered. - $user_membership = wc_memberships_get_user_membership( $user_id, $args['plan_id'] ); - $user_membership->add_note( 'Membership access granted automatically from registration.' ); + // Optional: get the new membership and add a note so we know how this was registered. + $user_membership = wc_memberships_get_user_membership( $user_id, $args['plan_id'] ); + $user_membership->add_note( 'Membership access granted automatically from registration.' ); } add_action( 'user_register', 'sv_wc_memberships_user_membership_at_registration', 15 ); diff --git a/woocommerce-memberships/frontend/add-support-for-facet-wp.php b/woocommerce-memberships/frontend/add-support-for-facet-wp.php index 944f669..d57aded 100644 --- a/woocommerce-memberships/frontend/add-support-for-facet-wp.php +++ b/woocommerce-memberships/frontend/add-support-for-facet-wp.php @@ -9,11 +9,10 @@ */ function sv_memberships_facetwp_compatibility( $is_main_query, $query ) { - if ( 'wc_user_membership' == $query->get( 'post_type' ) ) { - $is_main_query = false; - } - - return $is_main_query; -} + if ( 'wc_user_membership' == $query->get( 'post_type' ) ) { + $is_main_query = false; + } + return $is_main_query; +} add_filter( 'facetwp_is_main_query', 'sv_memberships_facetwp_compatibility' , 10, 2 ); diff --git a/woocommerce-memberships/frontend/change-restricted-content-excerpt-length.php b/woocommerce-memberships/frontend/change-restricted-content-excerpt-length.php index ba7f712..5fa4efe 100644 --- a/woocommerce-memberships/frontend/change-restricted-content-excerpt-length.php +++ b/woocommerce-memberships/frontend/change-restricted-content-excerpt-length.php @@ -7,9 +7,9 @@ * This could let you remove the message HTML to add your own, adjust the excerpt or * displayed content, or conditionally change restricted views for certain posts */ - -/** + +/** * Example of adjusting restricted content (v1.6.0+) * Changes excerpts to use 120 words instead of WordPress default * @@ -21,11 +21,10 @@ */ function sv_wc_memberships_filter_restricted_content( $content, $restricted, $message, $post ) { - if ( true === $restricted ) { - - return wp_trim_words( $content, 120 ) . $message ; - } + if ( true === $restricted ) { + return wp_trim_words( $content, 120 ) . $message; + } - return $content; -} -add_filter( 'wc_memberships_the_restricted_content', 'sv_wc_memberships_filter_restricted_content', 10, 4 ); \ No newline at end of file + return $content; +} +add_filter( 'wc_memberships_the_restricted_content', 'sv_wc_memberships_filter_restricted_content', 10, 4 ); diff --git a/woocommerce-memberships/frontend/member-area/add-author-column-to-my-content.php b/woocommerce-memberships/frontend/member-area/add-author-column-to-my-content.php index bd0b51e..9570dce 100644 --- a/woocommerce-memberships/frontend/member-area/add-author-column-to-my-content.php +++ b/woocommerce-memberships/frontend/member-area/add-author-column-to-my-content.php @@ -8,19 +8,19 @@ */ function sv_wc_memberships_my_content_table_add_column( $columns ) { - $new_columns = array(); + $new_columns = array(); - foreach ( $columns as $column_id => $column_name ) { + foreach ( $columns as $column_id => $column_name ) { - $new_columns[ $column_id ] = $column_name; + $new_columns[ $column_id ] = $column_name; - // insert our new "Author" column after the "Title" column - if ( 'membership-content-title' === $column_id ) { - $new_columns['membership-content-author'] = __( 'Author', 'your-textdomain' ); - } - } + // insert our new "Author" column after the "Title" column + if ( 'membership-content-title' === $column_id ) { + $new_columns['membership-content-author'] = __( 'Author', 'your-textdomain' ); + } + } - return $new_columns; + return $new_columns; } add_filter( 'wc_memberships_members_area_my_membership_content_column_names', 'sv_members_area_content_table_columns', 11 ); diff --git a/woocommerce-memberships/frontend/member-area/change-member-area-section-heading.php b/woocommerce-memberships/frontend/member-area/change-member-area-section-heading.php index 477a415..0ea4f90 100644 --- a/woocommerce-memberships/frontend/member-area/change-member-area-section-heading.php +++ b/woocommerce-memberships/frontend/member-area/change-member-area-section-heading.php @@ -8,6 +8,6 @@ * @return string $title the updated heading text */ function sv_wc_memberships_members_area_section_title( $title ) { - return __( 'Exclusive Discounts', 'your-textdomain' ); + return __( 'Exclusive Discounts', 'your-textdomain' ); } add_filter( 'wc_memberships_members_area_my_membership_discounts_title', 'sv_wc_memberships_members_area_section_title' ); diff --git a/woocommerce-memberships/frontend/member-area/filter-member-area-my-content-query.php b/woocommerce-memberships/frontend/member-area/filter-member-area-my-content-query.php index 116f82e..df80b8b 100644 --- a/woocommerce-memberships/frontend/member-area/filter-member-area-my-content-query.php +++ b/woocommerce-memberships/frontend/member-area/filter-member-area-my-content-query.php @@ -12,6 +12,7 @@ * * @param array $query_args args for retrieving membership content * @param string $type Type of request: 'content_restriction', 'product_restriction', 'purchasing_discount' + * @return array updated query args */ function sv_wc_memberships_sort_my_content( $query_args, $type ) { @@ -34,6 +35,7 @@ function sv_wc_memberships_sort_my_content( $query_args, $type ) { * * @param array $query_args args for retrieving membership content * @param string $type Type of request: 'content_restriction', 'product_restriction', 'purchasing_discount' + * @return array updated query args */ function sv_wc_memberships_adjust_my_content_query( $query_args, $type ) { diff --git a/woocommerce-memberships/frontend/member-area/remove-my-content-type-column.php b/woocommerce-memberships/frontend/member-area/remove-my-content-type-column.php index dd98ea0..dc99ea8 100644 --- a/woocommerce-memberships/frontend/member-area/remove-my-content-type-column.php +++ b/woocommerce-memberships/frontend/member-area/remove-my-content-type-column.php @@ -8,8 +8,8 @@ */ function sv_wc_memberships_my_content_table_columns( $columns ) { - // unset the "type" column, which shows post, page, etc - unset( $columns['membership-content-type'] ); - return $columns; + // unset the "type" column, which shows post, page, etc + unset( $columns['membership-content-type'] ); + return $columns; } add_filter( 'wc_memberships_members_area_my_membership_content_column_names', 'sv_wc_memberships_my_content_table_columns', 11 ); diff --git a/woocommerce-memberships/frontend/member-area/remove-my-products-excerpt-column.php b/woocommerce-memberships/frontend/member-area/remove-my-products-excerpt-column.php index 5ab8237..25c9b50 100644 --- a/woocommerce-memberships/frontend/member-area/remove-my-products-excerpt-column.php +++ b/woocommerce-memberships/frontend/member-area/remove-my-products-excerpt-column.php @@ -9,7 +9,7 @@ */ function sv_wc_memberships_my_products_table_columns( $columns ) { - unset( $columns['membership-product-excerpt'] ); - return $columns; + unset( $columns['membership-product-excerpt'] ); + return $columns; } add_filter('wc_memberships_members_area_my_membership_products_column_names', 'sv_wc_memberships_my_products_table_columns', 10, 1 ); diff --git a/woocommerce-memberships/frontend/member-area/remove-renew-action.php b/woocommerce-memberships/frontend/member-area/remove-renew-action.php index 79e5531..32fd21a 100644 --- a/woocommerce-memberships/frontend/member-area/remove-renew-action.php +++ b/woocommerce-memberships/frontend/member-area/remove-renew-action.php @@ -7,15 +7,15 @@ * @param \WC_Memberships_User_Membership $user_membership User Membership object * @return array $actions the updated array of actions */ - + function sv_wc_memberships_edit_my_memberships_actions( $actions, $user_membership ) { - + // we could check the plan slug if you only want to unset this for certain memberships - // if ( 'silver' !== $user_membership->get_plan()->get_slug() ) { - // return $actions; + // if ( 'silver' !== $user_membership->get_plan()->get_slug() ) { + // return $actions; // } - + unset( $actions['renew'] ); return $actions; } -add_filter( 'wc_memberships_members_area_my-memberships_actions', 'sv_wc_memberships_edit_my_memberships_actions', 10, 2 ); \ No newline at end of file +add_filter( 'wc_memberships_members_area_my-memberships_actions', 'sv_wc_memberships_edit_my_memberships_actions', 10, 2 ); diff --git a/woocommerce-memberships/frontend/member-area/rename-member-area-section-links.php b/woocommerce-memberships/frontend/member-area/rename-member-area-section-links.php index efede4a..f86abf5 100644 --- a/woocommerce-memberships/frontend/member-area/rename-member-area-section-links.php +++ b/woocommerce-memberships/frontend/member-area/rename-member-area-section-links.php @@ -9,11 +9,11 @@ */ function sv_wc_memberships_rename_member_area_sections( $sections ) { - $sections['my-membership-content'] = __( 'Club Articles', 'my-text-domain' ); - $sections['my-membership-products'] = __( 'Club Products', 'my-text-domain' ); - $sections['my-membership-discounts'] = __( 'Exclusive Discounts', 'my-text-domain' ); - $sections['my-membership-notes'] = __( 'Notes from MySite', 'my-text-domain' ); + $sections['my-membership-content'] = __( 'Club Articles', 'my-text-domain' ); + $sections['my-membership-products'] = __( 'Club Products', 'my-text-domain' ); + $sections['my-membership-discounts'] = __( 'Exclusive Discounts', 'my-text-domain' ); + $sections['my-membership-notes'] = __( 'Notes from MySite', 'my-text-domain' ); - return $sections; + return $sections; } add_filter( 'wc_membership_plan_members_area_sections', 'sv_wc_memberships_rename_member_area_sections' ); diff --git a/woocommerce-memberships/frontend/product-member-discount-notice.php b/woocommerce-memberships/frontend/product-member-discount-notice.php index c8fbae1..9162748 100644 --- a/woocommerce-memberships/frontend/product-member-discount-notice.php +++ b/woocommerce-memberships/frontend/product-member-discount-notice.php @@ -7,16 +7,16 @@ function sv_wc_memberships_member_discount_product_notice() { // bail if Memberships isn't active - if ( ! function_exists( 'wc_memberships' ) ) { - return; - } + if ( ! function_exists( 'wc_memberships' ) ) { + return; + } - // Set a discount end date - $discount_ends = date_i18n( wc_date_format(), strtotime( '2015-12-31' ) ); + // Set a discount end date + $discount_ends = date_i18n( wc_date_format(), strtotime( '2015-12-31' ) ); - // Add our top notice if the member has a discount - if ( wc_memberships_user_has_member_discount() ) { - wc_print_notice( sprintf( 'Act fast! Your member discount ends on %s.', $discount_ends ), 'notice' ); - } + // Add our top notice if the member has a discount + if ( wc_memberships_user_has_member_discount() ) { + wc_print_notice( sprintf( 'Act fast! Your member discount ends on %s.', $discount_ends ), 'notice' ); + } } add_action( 'woocommerce_before_single_product', 'sv_wc_memberships_member_discount_product_notice' ); diff --git a/woocommerce-memberships/frontend/product-restricted-notice.php b/woocommerce-memberships/frontend/product-restricted-notice.php index c7d7f4b..b9e1311 100644 --- a/woocommerce-memberships/frontend/product-restricted-notice.php +++ b/woocommerce-memberships/frontend/product-restricted-notice.php @@ -8,20 +8,20 @@ function sv_wc_memberships_members_only_product_notice() { // bail if Memberships isn't active - if ( ! function_exists( 'wc_memberships' ) ) { - return; - } + if ( ! function_exists( 'wc_memberships' ) ) { + return; + } - $user_id = get_current_user_id(); + $user_id = get_current_user_id(); - // Bail if the user is already a silver or gold member - if ( wc_memberships_is_user_active_member( $user_id, 'silver' ) || wc_memberships_is_user_active_member( $user_id, 'gold' ) ) { - return; - } + // Bail if the user is already a silver or gold member + if ( wc_memberships_is_user_active_member( $user_id, 'silver' ) || wc_memberships_is_user_active_member( $user_id, 'gold' ) ) { + return; + } - // Add our top notice if purchasing is restricted - if ( wc_memberships_is_product_purchasing_restricted() ) { - wc_print_notice( 'This is a preview! Only silver or gold members can purchase this product.', 'notice' ); - } + // Add our top notice if purchasing is restricted + if ( wc_memberships_is_product_purchasing_restricted() ) { + wc_print_notice( 'This is a preview! Only silver or gold members can purchase this product.', 'notice' ); + } } add_action( 'woocommerce_before_single_product', 'sv_wc_memberships_members_only_product_notice' ); diff --git a/woocommerce-memberships/frontend/remove-my-memberships-table.php b/woocommerce-memberships/frontend/remove-my-memberships-table.php index e9f592a..29c4a47 100644 --- a/woocommerce-memberships/frontend/remove-my-memberships-table.php +++ b/woocommerce-memberships/frontend/remove-my-memberships-table.php @@ -4,8 +4,9 @@ * Removes the "My Memberships" table from my account area */ function sv_remove_my_memberships_table() { - if ( function_exists( 'wc_memberships' ) && ! is_admin() ) { - remove_action( 'woocommerce_before_my_account', array( wc_memberships()->get_frontend_instance()->get_member_area_instance(), 'my_account_memberships' ) ); - } + + if ( function_exists( 'wc_memberships' ) && ! is_admin() ) { + remove_action( 'woocommerce_before_my_account', array( wc_memberships()->get_frontend_instance()->get_member_area_instance(), 'my_account_memberships' ) ); + } } -add_action( 'init', 'sv_remove_my_memberships_table', 50 ); \ No newline at end of file +add_action( 'init', 'sv_remove_my_memberships_table', 50 ); diff --git a/woocommerce-memberships/prevent-purchasing-multiple-active-memberships.php b/woocommerce-memberships/prevent-purchasing-multiple-active-memberships.php index cf07ce9..625e8b0 100644 --- a/woocommerce-memberships/prevent-purchasing-multiple-active-memberships.php +++ b/woocommerce-memberships/prevent-purchasing-multiple-active-memberships.php @@ -26,7 +26,7 @@ function sv_wc_memberships_limit_membership_count( $grant_access, $args ) { // you can remove any of these if you don't want to allow multiples // ie you may not want to count complimentary memberships $statuses = array( - 'status' => array( 'active', 'complimentary', 'pending', 'free_trial' ), + 'status' => array( 'active', 'complimentary', 'pending', 'free_trial' ), ); $active_memberships = wc_memberships_get_user_memberships( $args['user_id'], $statuses ); diff --git a/woocommerce-memberships/separate-membership-access-from-subscription.php b/woocommerce-memberships/separate-membership-access-from-subscription.php index 9af7582..696eecb 100644 --- a/woocommerce-memberships/separate-membership-access-from-subscription.php +++ b/woocommerce-memberships/separate-membership-access-from-subscription.php @@ -8,7 +8,7 @@ * * @param bool $joined true if membership is coupled to a subscription * @param int $plan_id the user membership's membership plan ID - * @returm bool $joined + * @return bool $joined */ function sv_wc_memberships_decouple_membership_from_sub( $joined, $plan_id ) { diff --git a/woocommerce-nested-category-layout/remove-parent-category-from-child-name.php b/woocommerce-nested-category-layout/remove-parent-category-from-child-name.php index 04ab168..0dc0134 100644 --- a/woocommerce-nested-category-layout/remove-parent-category-from-child-name.php +++ b/woocommerce-nested-category-layout/remove-parent-category-from-child-name.php @@ -3,22 +3,21 @@ * Remove parent category name from child category names in nested layout * * @param string $title the category title - * @param array $categories the categories the product is in - * @return string the updated title + * @param array $categories the categories the product is in + * @return string the updated title */ function sv_wc_nested_category_layout_category_title_html( $title, $categories ) { // get the first / parent category $category = $categories[ count( $categories ) - 1 ]; - + // get the the category archive link $url = esc_attr( get_term_link( $category ) ); - + // rebuild the link to this category with its name - $link = '' . wptexturize( $category->name ) . ''; - + $link = '' . wptexturize( $category->name ) . ''; + // package it as a heading return sprintf( '

%s

', $link ); - } -add_filter( 'wc_nested_category_layout_category_title_html', 'sv_wc_nested_category_layout_category_title_html', 10, 2 ); \ No newline at end of file +add_filter( 'wc_nested_category_layout_category_title_html', 'sv_wc_nested_category_layout_category_title_html', 10, 2 ); diff --git a/woocommerce-pdf-product-vouchers/change-voucher-image-dpi.php b/woocommerce-pdf-product-vouchers/change-voucher-image-dpi.php index 7e69d62..5835620 100644 --- a/woocommerce-pdf-product-vouchers/change-voucher-image-dpi.php +++ b/woocommerce-pdf-product-vouchers/change-voucher-image-dpi.php @@ -1,4 +1,10 @@ -get_image_id() to check for a specific attachment id - // example: if ( 42 === $voucher->get_image_id() ) { bail or change DPI } - return 300; + // can use $voucher->get_image_id() to check for a specific attachment id + // example: if ( 42 === $voucher->get_image_id() ) { bail or change DPI } + return 300; } -add_filter( 'wc_pdf_product_vouchers_voucher_image_dpi', 'sv_wc_pdf_product_vouchers_image_dpi', 10, 2 ); \ No newline at end of file +add_filter( 'wc_pdf_product_vouchers_voucher_image_dpi', 'sv_wc_pdf_product_vouchers_image_dpi', 10, 2 ); diff --git a/woocommerce-print-invoices-packing-lists/add-invoice-email-recipients.php b/woocommerce-print-invoices-packing-lists/add-invoice-email-recipients.php index ab6bc50..6283745 100644 --- a/woocommerce-print-invoices-packing-lists/add-invoice-email-recipients.php +++ b/woocommerce-print-invoices-packing-lists/add-invoice-email-recipients.php @@ -7,8 +7,8 @@ * @return string $recipient the updated list of email recipients */ function sv_wc_pip_invoice_email_recipient( $recipient, $document ) { - + $recipient .= ', warehouse-manager@example.com, admin@example.com'; return $recipient; } -add_filter( 'woocommerce_email_recipient_pip_email_invoice', 'sv_wc_pip_invoice_email_recipient', 10, 2 ); \ No newline at end of file +add_filter( 'woocommerce_email_recipient_pip_email_invoice', 'sv_wc_pip_invoice_email_recipient', 10, 2 ); diff --git a/woocommerce-print-invoices-packing-lists/custom-columns-warranty-warehouse.php b/woocommerce-print-invoices-packing-lists/custom-columns-warranty-warehouse.php index a80be62..4cc48a3 100644 --- a/woocommerce-print-invoices-packing-lists/custom-columns-warranty-warehouse.php +++ b/woocommerce-print-invoices-packing-lists/custom-columns-warranty-warehouse.php @@ -14,10 +14,9 @@ function sv_wc_pip_document_table_headers( $table_headers, $order_id, $type ) { if ( 'invoice' === $type ) { $table_headers['warranty'] = 'Warranty'; - } // add custom columns for packing and pick lists - elseif ( 'packing-list' === $type || 'pick-list' === $type ) { + } elseif ( 'packing-list' === $type || 'pick-list' === $type ) { $table_headers['warehouse_location'] = 'Warehouse'; } diff --git a/woocommerce-print-invoices-packing-lists/view-invoice-button-link-html.php b/woocommerce-print-invoices-packing-lists/view-invoice-button-link-html.php index 3e358b5..fb5f2b1 100644 --- a/woocommerce-print-invoices-packing-lists/view-invoice-button-link-html.php +++ b/woocommerce-print-invoices-packing-lists/view-invoice-button-link-html.php @@ -1,7 +1,7 @@ ' . $button . ''; } - - return $button; -} + return $button; +} add_filter( 'wc_pip_view_invoice_button_html', 'sv_pip_view_invoice_button_html', 10, 2 ); - diff --git a/woocommerce-product-documents/hide-documents-for-guest-users.php b/woocommerce-product-documents/hide-documents-for-guest-users.php index 99ad14a..54dabb9 100644 --- a/woocommerce-product-documents/hide-documents-for-guest-users.php +++ b/woocommerce-product-documents/hide-documents-for-guest-users.php @@ -3,18 +3,17 @@ * Don't show document sections unless there is a logged in user. * * @param array $sections array of sections - * @param WC_Product_Documents_Collection $collection the collection object + * @param \WC_Product_Documents_Collection $collection the collection object * @param boolean $include_empty whether to include empty sections in the result * @return array sections for display */ function sv_wc_product_documents_only_for_logged_in_users( $sections, $collection, $include_empty ) { - // this check can be made as specific (by user role, etc) as desired - if ( ! get_current_user_id() ) { - return array(); - } - - return $sections; + // this check can be made as specific (by user role, etc) as desired + if ( ! get_current_user_id() ) { + return array(); + } + return $sections; } -add_filter( 'wc_product_documents_get_sections', 'sv_wc_product_documents_only_for_logged_in_users', 10, 3 ); \ No newline at end of file +add_filter( 'wc_product_documents_get_sections', 'sv_wc_product_documents_only_for_logged_in_users', 10, 3 ); diff --git a/woocommerce-product-retailers/conditionally-change-retailer-button-text.php b/woocommerce-product-retailers/conditionally-change-retailer-button-text.php index 5d4372f..4995539 100644 --- a/woocommerce-product-retailers/conditionally-change-retailer-button-text.php +++ b/woocommerce-product-retailers/conditionally-change-retailer-button-text.php @@ -6,40 +6,40 @@ * @param string $label the button text * @param object $retailer the retailer post object * @param obj $product the currently viewed product + * @return string retailer button label */ function skyverge_change_retailer_buttons( $label, $retailer, $product ) { $name = $retailer->get_name(); - + // Use the retailer name whose buttons you'd like to change if ( 'Amazon' === $name ) { - + // Use your product category slugs to set new labels if ( has_term( 'Books', 'product_cat' ) ) { - + $label = 'Buy Paperback at Amazon'; - - } elseif( has_term( 'Shoes', 'product_cat' ) ) { - + + } elseif ( has_term( 'Shoes', 'product_cat' ) ) { + $label = 'Shop Amazon Shoes'; - - } elseif( has_term( 'Jewelry', 'product_cat' ) ) { - + + } elseif ( has_term( 'Jewelry', 'product_cat' ) ) { + $label = 'Shop Amazon Jewelry'; - + } else { - + // give back the original Amazon label return $label; - } - + // Spit out our new text + price if we're changing the label // Use your currency symbol instead of $ if different from US dollars return $label . ' - $' . $retailer->get_price(); } - + // if not Amazon, just return the original label return $label; } -add_filter( 'wc_product_retailers_button_label', 'skyverge_change_retailer_buttons', 10, 3 ); \ No newline at end of file +add_filter( 'wc_product_retailers_button_label', 'skyverge_change_retailer_buttons', 10, 3 ); diff --git a/woocommerce-product-reviews-pro/add-social-login-buttons-to-product-reviews-pro-modal.php b/woocommerce-product-reviews-pro/add-social-login-buttons-to-product-reviews-pro-modal.php index 7d025aa..e7c0715 100644 --- a/woocommerce-product-reviews-pro/add-social-login-buttons-to-product-reviews-pro-modal.php +++ b/woocommerce-product-reviews-pro/add-social-login-buttons-to-product-reviews-pro-modal.php @@ -3,14 +3,14 @@ * Adds social login buttons to the Product Reviews Pro login modal * and changes the instruction text to make it more relevant */ - + /** * Add login buttons to the Product Reviews Pro login modal */ function sv_wc_social_login_add_buttons_prpro() { - // only do this on the product pages + // only do this on the product pages if ( is_product() && function_exists( 'woocommerce_social_login_buttons' ) ) { woocommerce_social_login_buttons( home_url( add_query_arg( array() ) ) . '#tab-reviews#comment-1' ); } @@ -23,15 +23,16 @@ function sv_wc_social_login_add_buttons_prpro() { * so we're not talking about checkout for a product review. * * @param string $login_text the original text from Social Login settings - * @return strong $login_text the updated text for PRPro use + * + * @return string $login_text the updated text for PRPro use */ function sv_wc_social_login_change_prpro_login_text( $login_text ) { // Only modify the text from this option if we're on a product page if ( is_product() ) { - $login_text = __( 'You can also create an account or log in with a social network.', 'my-textdomain' ); - } - - return $login_text; + $login_text = __( 'You can also create an account or log in with a social network.', 'my-textdomain' ); + } + + return $login_text; } -add_filter( 'pre_option_wc_social_login_text', 'sv_wc_social_login_change_prpro_login_text' ); \ No newline at end of file +add_filter( 'pre_option_wc_social_login_text', 'sv_wc_social_login_change_prpro_login_text' ); diff --git a/woocommerce-shipping-local-pickup-plus/add-pickup-instruction-text.php b/woocommerce-shipping-local-pickup-plus/add-pickup-instruction-text.php index 40bf9bf..57b3c72 100644 --- a/woocommerce-shipping-local-pickup-plus/add-pickup-instruction-text.php +++ b/woocommerce-shipping-local-pickup-plus/add-pickup-instruction-text.php @@ -1,9 +1,10 @@ -Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do...

'; + echo '

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do...

'; } -add_action( 'woocommerce_review_order_before_local_pickup_location', 'sv_wc_local_pickup_plus_add_instructions' ); \ No newline at end of file +add_action( 'woocommerce_review_order_before_local_pickup_location', 'sv_wc_local_pickup_plus_add_instructions' ); diff --git a/woocommerce-shipping-local-pickup-plus/show-locations-alphabetically.php b/woocommerce-shipping-local-pickup-plus/show-locations-alphabetically.php index f710da8..05c6f3a 100644 --- a/woocommerce-shipping-local-pickup-plus/show-locations-alphabetically.php +++ b/woocommerce-shipping-local-pickup-plus/show-locations-alphabetically.php @@ -1,8 +1,12 @@ -get_frontend_instance(), 'render_social_login_buttons' ) ); - add_action( 'woocommerce_register_form_end', array( wc_social_login()->get_frontend_instance(), 'render_social_login_buttons' ) ); - } + + if ( function_exists( 'wc_social_login' ) && ! is_admin() ) { + remove_action( 'woocommerce_login_form_end', array( wc_social_login()->get_frontend_instance(), 'render_social_login_buttons' ) ); + add_action( 'woocommerce_register_form_end', array( wc_social_login()->get_frontend_instance(), 'render_social_login_buttons' ) ); + } } add_action( 'init', 'sv_wc_social_login_move_register_buttons' ); diff --git a/woocommerce-twilio-sms-notifications/remove-checkout-optin.php b/woocommerce-twilio-sms-notifications/remove-checkout-optin.php index c6c87d9..4279a33 100644 --- a/woocommerce-twilio-sms-notifications/remove-checkout-optin.php +++ b/woocommerce-twilio-sms-notifications/remove-checkout-optin.php @@ -4,6 +4,5 @@ * Removes Twilio input fields from checkout, allowing it to be used for admin alerts only. * Customers will not receive any notifications or be able to opt into them. */ - remove_action( 'woocommerce_after_checkout_billing_form', array( wc_twilio_sms(), 'add_opt_in_checkbox' ) ); -remove_action( 'woocommerce_checkout_update_order_meta', array( wc_twilio_sms(), 'process_opt_in_checkbox' ) ); \ No newline at end of file +remove_action( 'woocommerce_checkout_update_order_meta', array( wc_twilio_sms(), 'process_opt_in_checkbox' ) );