Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the Shipping Address for virtual products #26

Open
wants to merge 30 commits into
base: snippets-review-pip
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8f6a7b3
Archive retired/transferred plugins
tamarazuk Jul 8, 2021
fd04877
Update add-item-price-to-order-export.php
skyvergesteve Jul 9, 2021
6c60d87
Code review update
smoen-godaddy Jul 13, 2021
90ff4c2
Updated for code standards review
ericabross Jul 13, 2021
9ae0a95
Update re-order-customer-export-columns.php
smoen-godaddy Jul 15, 2021
4f16560
Update re-order-order-export-columns.php
smoen-godaddy Jul 15, 2021
face337
Merge pull request #21 from skyverge/snippets-review-export
stevemoen Jul 15, 2021
49a76fc
Update add-coupon-codes-column.php
smoen-godaddy Jul 15, 2021
882a54a
Merge pull request #23 from skyverge/snippets-review-export
stevemoen Jul 15, 2021
ca2b340
Merge pull request #24 from skyverge/snippets-review-export
stevemoen Jul 15, 2021
f8e2c78
Order Status Manager: added snippet to use a custom status after chec…
erica3738-godaddy Aug 19, 2021
8fcb4d3
Checkout Add-ons: Update Polylang snippet to be compatible with lates…
Nov 27, 2021
1a77570
Create invoice-add-discount-columns.php
benjdotxyz Jan 11, 2022
96e0203
Updated the filter for cancel action
erica3738-godaddy Feb 2, 2022
837fdc1
Updated to add a snippet for both the "My Memberships" and "Membershi…
erica3738-godaddy Feb 2, 2022
29d8280
Corrected variable name
benjdotxyz Mar 21, 2022
3decf6e
Corrected Variable Name
benjdotxyz Mar 21, 2022
172bbdb
Memberships: Created change-content-category-restriction-messages.php
benjdotxyz Apr 1, 2022
a5219be
Create change-mark-as-exported-default-to-false.php
nikmclaughlin May 20, 2022
7dc3fef
Create change-memberships-email-thank-you-footer-message.php
benjdotxyz Jul 14, 2022
ac81274
Create add-email-variables-to-custom-statuses.php
jlareaux-godaddy Aug 8, 2022
0485296
PDF Product Vouchers: Remove expires column from Vouchers section in …
kburge-godaddy Dec 20, 2022
2833ec8
Fix default member area section snippet
nikolas4175-godaddy Jan 6, 2023
8b113e6
Create handle-sca-indicator-for-uk-ie.php
nikolas4175-godaddy Apr 7, 2023
723ce10
Merge pull request #22 from godaddy-wordpress/snippets-review-members…
nikolas4175-godaddy Nov 10, 2023
c9080a2
Merge pull request #30 from godaddy-wordpress/snippets-review
nikolas4175-godaddy Nov 10, 2023
e43b4bd
Create sort-directory-members-alphabetically.php
nikolas4175-godaddy Mar 28, 2024
f58f771
Update remove-notices-from-checkout.php
smoen-godaddy Jun 25, 2024
7797c95
Update remove-notices-from-cart.php
smoen-godaddy Jun 25, 2024
1f4bdd0
Elavon Converge: Add rate limiting snippets
kburge-godaddy Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
9 changes: 4 additions & 5 deletions woocommerce-cart-notices/remove-notices-from-cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
* Removes any Cart Notices from the cart page, leaving them only at checkout.
*/
function sv_wc_cart_notices_remove_on_cart() {

if ( function_exists( 'wc_cart_notices' ) ) {
remove_action( 'woocommerce_before_cart_contents', array( wc_cart_notices(), 'add_cart_notice' ) );
}
if ( is_cart() ) {
remove_action( 'wp', array( wc_cart_notices(), 'add_cart_notices' ) );
}
}
add_action( 'init', 'sv_wc_cart_notices_remove_on_cart' );
add_action( 'wp', 'sv_wc_cart_notices_remove_on_cart', 5 );
8 changes: 4 additions & 4 deletions woocommerce-cart-notices/remove-notices-from-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/
function sv_wc_cart_notices_remove_on_checkout() {

if ( function_exists( 'wc_cart_notices' ) ) {
remove_action( 'woocommerce_before_checkout_form', array( wc_cart_notices(), 'add_cart_notice' ) );
}
if ( is_checkout() ) {
remove_action( 'wp', array( wc_cart_notices(), 'add_cart_notices' ) );
}
}
add_action( 'init', 'sv_wc_cart_notices_remove_on_checkout' );
add_action( 'wp', 'sv_wc_cart_notices_remove_on_checkout', 5 );
28 changes: 12 additions & 16 deletions woocommerce-checkout-add-ons/polylang-translate-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,23 @@
*/
function sv_wc_coa_register_polylang_strings() {

if ( function_exists( 'wc_checkout_add_ons' ) && function_exists( 'pll_register_string' ) ) {
if ( class_exists( 'SkyVerge\WooCommerce\Checkout_Add_Ons\Add_Ons\Add_On_Factory' ) && function_exists( 'pll_register_string' ) ) {

$add_ons = wc_checkout_add_ons()->get_add_ons();
$add_ons = SkyVerge\WooCommerce\Checkout_Add_Ons\Add_Ons\Add_On_Factory::get_add_ons() ;

foreach ( $add_ons as $id => $add_on ) {

$add_on_label = ! empty( $add_on->label ) ? $add_on->label : $add_on->name;
pll_register_string( $add_on->name, $add_on_label, 'woocommerce-checkout-add-ons' );

$add_on_label = ! empty( $add_on->get_label() ) ? $add_on->get_label() : $add_on->get_name();
pll_register_string( 'checkout_add_on_label: ' . $add_on->get_name(), $add_on_label, 'woocommerce-checkout-add-ons' );
// if the add-on has options, register these option labels, too
if ( $add_on->has_options() ) {

$options = $add_on->get_options( false );
$options = $add_on->get_options( 'edit' );

foreach ( $options as $option ) {
pll_register_string( $option['value'], $option['label'], 'woocommerce-checkout-add-ons' );

pll_register_string( 'checkout_add_on_option', $option['label'], 'woocommerce-checkout-add-ons' );
}
}
}
Expand All @@ -44,15 +45,10 @@ function sv_wc_coa_register_polylang_strings() {
* @return string translated label
*/
function sv_wc_coa_polylang_translate_labels( $label ) {

if ( function_exists( 'pll__' ) ) {
$label = pll__( $label );
}

return $label;
return function_exists( 'pll__' ) ? pll__( $label ) : $label;
}
add_filter( 'wc_checkout_add_ons_add_on_label', 'sv_wc_coa_polylang_translate_labels' );
add_filter( 'wc_checkout_add_ons_add_on_name', 'sv_wc_coa_polylang_translate_labels' );
add_filter( 'woocommerce_checkout_add_on_get_label', 'sv_wc_coa_polylang_translate_labels' );
add_filter( 'woocommerce_checkout_add_on_get_name', 'sv_wc_coa_polylang_translate_labels' );


/**
Expand All @@ -75,4 +71,4 @@ function sv_wc_coa_polylang_translate_options( $options ) {

return ! empty( $translated_options ) ? $translated_options : $options;
}
add_filter( 'wc_checkout_add_ons_options', 'sv_wc_coa_polylang_translate_options' );
add_filter( 'woocommerce_checkout_add_on_get_options', 'sv_wc_coa_polylang_translate_options' );
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php //only copy this line if needed

/**
* Set "Mark as exported" option on the Manual Export page to false (unchecked) by default
*
* @param array $options the array of options for the export tab
*/
add_filter( 'wc_customer_order_export_options', function( $options ){

foreach ( [ \WC_Customer_Order_CSV_Export::EXPORT_TYPE_ORDERS, \WC_Customer_Order_CSV_Export::EXPORT_TYPE_CUSTOMERS ] as $export_type ) {

$options[ "${export_type}_mark_as_exported" ]['default'] = 'no';
}

return $options;
} );
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
function sv_wc_csv_export_add_coupon_codes_column( $column_headers, $csv_generator ) {

$new_columns = array();
$new_columns = [];

foreach ( $column_headers as $id => $header ) {

Expand All @@ -43,18 +43,16 @@ function sv_wc_csv_export_add_coupon_codes_column( $column_headers, $csv_generat
*/
function sv_wc_csv_export_add_coupon_codes_data( $order_data, $order, $csv_generator ) {

$new_order_data = array();
$new_order_data = [];
$one_row_per_item = false;
$coupons = array();
$coupons = [];
$coupon_lines = $order->get_items( 'coupon' );

foreach( $coupon_lines as $coupon ) {
$coupons[] = sanitize_text_field( $coupon['name'] );
}

$custom_data = array(
'coupon_codes' => implode( '|', $coupons ),
);
$custom_data = ['coupon_codes' => implode( '|', $coupons ),];

if ( version_compare( wc_customer_order_csv_export()->get_version(), '4.0.0', '<' ) ) {
$one_row_per_item = ( 'default_one_row_per_item' === $csv_generator->order_format || 'legacy_one_row_per_item' === $csv_generator->order_format );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
function sv_wc_csv_export_order_line_item_price( $line_item, $item, $product ) {

$new_line_item = array();
$new_line_item = [];

foreach ( $line_item as $key => $data ) {

Expand Down Expand Up @@ -61,7 +61,7 @@ function sv_wc_csv_export_modify_column_headers_item_price( $column_headers, $cs
// add after 'item_sku' column if it exists
if ( isset( $column_headers['item_sku'] ) ) {

$new_headers = array();
$new_headers = [];

foreach ( $column_headers as $key => $column ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
function sv_wc_csv_export_order_line_item_sku( $line_item, $item, $product ) {

if ( $product->is_type( 'variation' ) ) {
// pre / post WC 3.0 compat
$sku = is_callable( array( $product, 'get_parent_id' ) ) ? wc_get_product( $product->get_parent_id() )->get_sku() : $product->parent->get_sku();

$sku = wc_get_product( $product->get_parent_id() )->get_sku();

$line_item['sku'] = $sku;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ function sv_wc_csv_export_reorder_customer_columns( $column_headers ) {
// remove customer_id from the original set of column headers, otherwise it will be duplicated
unset( $column_headers['customer_id'] );

$new_column_headers = array();
$new_column_headers = [];

foreach ( $column_headers as $key => $name ) {

$new_column_headers[ $key ] = $name;
$new_column_headers[$key] = $name;

if ( 'last_name' == $key ) {
// re-add customer_id immediately after last_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ function sv_wc_csv_export_reorder_columns( $column_headers ) {
// remove order total from the original set of column headers, otherwise it will be duplicated
unset( $column_headers['order_total'] );

$new_column_headers = array();
$new_column_headers = [];

foreach ( $column_headers as $column_key => $column_name ) {

$new_column_headers[ $column_key ] = $column_name;
$new_column_headers[$column_key] = $column_name;

if ( 'order_number' == $column_key ) {

Expand Down
Empty file.
Empty file.
10 changes: 10 additions & 0 deletions woocommerce-gateway-elavon/change-rate-limiting-delay-prior.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php // only copy this line if needed

/**
* Changes the rate limit delay
* Prior to WC 7.2.0
**/

add_filter('woocommerce_elavon_rate_limit_delay', function($delay) {
return 15; // number of seconds in between requests
});
14 changes: 14 additions & 0 deletions woocommerce-gateway-elavon/change-rate-limiting-settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php // only copy this line if needed

/**
* Updates rate limiting settings
* Default limit = 3; Default seconds = 45
* REQUIRES WooCommerce 7.2.0+
**/

add_filter('woocommerce_elavon_rate_limit_options', function($options) {
$options['limit'] = 3; // max amount of requests allowed in the timeframe (below)
$options['seconds'] = 45; // number of seconds before rate limits are reset

return $options;
});
10 changes: 10 additions & 0 deletions woocommerce-gateway-elavon/disable-rate-limiting-prior.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php // only copy this line if needed

/**
* Disables rate limiting
* Prior to WC 7.2.0
**/

add_filter('woocommerce_elavon_rate_limit_delay', function($delay) {
return 0;
});
12 changes: 12 additions & 0 deletions woocommerce-gateway-elavon/disable-rate-limiting.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php // only copy this line if needed

/**
* Disables rate limiting
* REQUIRES WooCommerce 7.2.0+
**/

add_filter('woocommerce_elavon_rate_limit_options', function($options) {
$options['enabled'] = false;

return $options;
});
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php //only copy this line if needed

/**
* Add the appropriate SCA indicator to the HPP parameters for UK/IE merchants whose banks do not handle these automatically
*
* @param array $params payment form request parameters
* @return array
*/
add_filter( 'wc_realex_redirect_hpp_params', function( $params ){

// Require SCA for UK/IE customers
if( $params[ 'BILLING_CO' ] === 'GB' || $params[ 'BILLING_CO' ] === 'IE' )
{
$params[ 'HPP_CHALLENGE_REQUEST_INDICATOR' ] = 'CHALLENGE_MANDATED';
}

// Allow issuer to determine preference for all others
else
{
$params[ 'HPP_CHALLENGE_REQUEST_INDICATOR' ] = 'NO_PREFERENCE';
}

return $params;
});
Empty file removed woocommerce-gateway-realex/.keep
Empty file.
4 changes: 4 additions & 0 deletions woocommerce-memberships/add-expiration-email-recipients.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ function sv_wc_add_membership_expiration_email_recipients( $recipient, $membersh

// use a comma-sep list as it will turn into an array after this filter
$recipient .= ',[email protected], [email protected]';

return $recipient;
}

// add recipients to the "Ending Soon" email
add_filter( 'woocommerce_email_recipient_WC_Memberships_User_Membership_Ending_Soon_Email', 'sv_wc_add_membership_expiration_email_recipients', 10, 2 );

// add these recipients to the "Membership Ended" email
add_filter( 'woocommerce_email_recipient_WC_Memberships_User_Membership_Ended_Email', 'sv_wc_add_membership_expiration_email_recipients', 10, 2 );

// add these recipients to the "Renewal Reminder" email
add_filter( 'woocommerce_email_recipient_WC_Memberships_User_Membership_Renewal_Reminder_Email', 'sv_wc_add_membership_expiration_email_recipients', 10, 2 );
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php // only copy this line if needed

/**
* Change Memberships email "thank you" footer message
*
* @param string $message the thank you message HTML
* @param int $order_id the order ID from the purchase, unused
* @param array $memberships associative array of membership IDs and granting access details found for the given order, unused
*
* @return string $message the updated string
*/

function sv_wcm_change_thank_you_msg( $message, $order_id, $memberships ){

$message = __( 'Thanks for purchasing a membership! You can view more details about your membership from your account.', 'woocommerce-memberships' ); // change this to desired message.
return $message;

}
add_filter( 'woocommerce_memberships_thank_you_message', 'sv_wcm_change_thank_you_msg', 10, 3);
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php // only copy if necessary

/*
* Edits the default content category restriction messages displayed to customers.
*
* @param array $messages containing default restriction messages
* @return array $messages the updated array
*/
function sv_wc_memberships_default_messages( $messages ) {

/* Content Category Restriction messages
*
* Basic HTML is allowed. You can also use the following merge tags:
* {products} automatically inserts the product(s) needed to gain access.
* {date} inserts the date when the member will gain access to delayed content.
* {discount} inserts the highest product discount obtainable by becoming a member.
* {login_url} inserts the URL to the “My Account” page with the login form.
* {login} inserts a login link to the “My Account” page with the login form.
*/

// edits message displayed when the content is time-delayed so not available _yet_
$messages['content_category_delayed_message'] = 'DESIRED_MESSAGE_GOES_HERE';

// edits message displayed when a category is restricted, but customers can purchase a product to get access
$messages['content_category_restricted_message'] = 'DESIRED_MESSAGE_GOES_HERE';

// edits message displayed when category is restricted and no product is available to purchase access to view category
$messages['content_category_restricted_message_no_products'] = 'DESIRED_MESSAGE_GOES_HERE';

// return the updated array
return $messages;
};

add_filter( 'wc_memberships_default_messages', 'sv_wc_memberships_default_messages', 10, 1 );
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php // only copy if needed!

/**
* Filters the members area section list so members land on the "Manage" section by default.
*
* @param string[] $sections the list of members area sections in their default order
* @return string[] updated list of sections
*/
function sv_wc_memberships_default_members_area_section( $sections ){

//Only modify if the current plan has access to 'Manage' section
if( in_array( 'Manage', $sections, true ) ){

// Move 'Manage' section to the beginning of the array so it appears on first load
$sections = array('my-membership-details' => $sections['my-membership-details']) + $sections;
}

return $sections;
}
add_filter( 'wc_membership_plan_members_area_sections', 'sv_wc_memberships_default_members_area_section', 10, 1);

This file was deleted.

Loading