This file contains 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
// Added on 06/03/23 by [email protected] | |
add_action('init', 'add_ipinfo_api_key_option'); | |
function add_ipinfo_api_key_option() { | |
if (get_option('ipinfo_api_key') === false) { | |
add_option('ipinfo_api_key', 'XXXXXXXX'); | |
} | |
} | |
// Add an action hook for handling the AJAX request |
This file contains 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
add_action('gform_after_submission', 'add_product_to_cart_and_checkout', 10, 2); | |
function add_product_to_cart_and_checkout($entry, $form) { | |
// Product mapping array | |
$product_mapping = array( | |
'Mycotoxin Panel' => 373340 | |
); | |
// Replace '4' with the ID of your Gravity Form | |
if ($form['id'] == 30) { | |
// Get selected product name from dropdown field ID 12 |
This file contains 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
if ( $F4 == '<img src="https://aspenhr.com/wp-content/uploads/2024/02/noto-desktop-computer.svg" alt="White Collar" title="White Collar">White Collar' ): | |
if($F7 == 'Alabama'): | |
$F1 + $F2 + ( $F1 * ($F3/100) ) + ($F1 * .0765) + (.028 * 8000 ) + 420 + ($F1 * .002) + $F10 | |
elseif($F7 == 'Alaska'): | |
$F1 + $F2 + ( $F1 * ($F3/100) ) + ($F1 * .0765) + (.032 * 48600 ) + 420 + ($F1 * .002) + $F10 | |
elseif($F7 == 'Arizona'): | |
$F1 + $F2 + ( $F1 * ($F3/100) ) + ($F1 * .0765) + (.094 * 8000 ) + 420 + ($F1 * .002) + $F10 | |
elseif($F7 == 'Arkansas'): | |
$F1 + $F2 + ( $F1 * ($F3/100) ) + ($F1 * .0765) + (.072 * 7000 ) + 420 + ($F1 * .002) + $F10 | |
elseif($F7 == 'California'): |
This file contains 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
/** | |
* Applies a combo discount when specific products are in the cart. | |
* | |
* This function checks if two or more products with the specified product IDs are in the cart. | |
* If both products are present, a discount is applied as a negative fee. | |
* | |
* @param WC_Cart $cart The WooCommerce cart instance. | |
*/ | |
function apply_discount_on_combo( $cart ) { | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
This file contains 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
/* | |
# Overview | |
This code connects a contact form on a Wix site to a HubSpot portal, so that form submissions are automatically synced to HubSpot as new contacts. | |
# Prerequisites | |
Before using this code, you'll need: | |
1. A Wix site with a contact form | |
2. A HubSpot account with a portal ID and form GUID |
This file contains 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
/** | |
Background: | |
Let's say we have ACF gallery field 'gallery_by_parents'. Users can upload as many images as they want to add into gallery from frontend. | |
When they upload it saves into their user profile in wp dashboard. | |
And in another page say photo album will show all images from each gallery of each user. | |
But admin of the site wants to control which image should appear in photo album page. | |
So we will create an option page where it will show a table, where user and their all images of gallery will be displayed. | |
And then we will add a checkbox beside of each image. | |
When admin will select the checkbox then associate image of that checkbox will be saved into option table into db. |
This file contains 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
<div class="collection_header_block"> | |
{{ collection.description | split: '---' | first }} | |
</div> | |
<div class="collection_footer_block"> | |
{{ collection. description | split: '---' | last }} | |
</div> |
This file contains 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
# First copy this code from footer.liquid file | |
<img src="{{ 'payment.png' | asset_url }}" alt="Payment" /> | |
and then go to `snippets` and find the `single-product-layout-type-1.liquid` file | |
And go to line #250 | |
and add the code: |
This file contains 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
add_action( 'woocommerce_checkout_before_customer_details', 'superdville_checkout_fields_before_billing_details', 20 ); | |
function superdville_checkout_fields_before_billing_details(){ | |
$domain = 'superDville'; | |
$checkout = WC()->checkout; | |
echo '<div class="col2-set" id="superdville_custom_checkout_field">'; | |
echo '<div class="col-1">'; | |
echo '<h3>' . __('User Details') . '</h3>'; | |
woocommerce_form_field( 'your_role', array( |
This file contains 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
add_filter( 'default_checkout_billing_country', 'change_default_checkout_country' ); | |
function change_default_checkout_country() { | |
if ( WC()->customer->get_is_paying_customer() ) { | |
return $country; | |
} | |
return 'US'; | |
} |
NewerOlder