This file contains hidden or 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('wp_footer', function () { | |
| ?> | |
| <style> | |
| /* Chat bubble styling */ | |
| .custom-chat-bubble { | |
| position: fixed; | |
| bottom: 20px; | |
| right: 20px; | |
| background: #2563eb; | |
| color: #fff; |
This file contains hidden or 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('wp_enqueue_scripts', function() { | |
| wp_register_style('lovable-product-cards', false); | |
| wp_enqueue_style('lovable-product-cards'); | |
| $css = <<<CSS | |
| /* Product Grid */ | |
| ul.products, | |
| ul.wp-block-products, | |
| div.wp-block-columns { |
This file contains hidden or 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
| /** | |
| * Gullhuset WooCommerce Custom Styles | |
| * Applies beautiful styling to default WooCommerce elements | |
| * Add this CSS to Appearance > Customize > Additional CSS or your theme's style.css | |
| */ | |
| /* Apply styles when our custom class is present or on WooCommerce pages */ | |
| .gullhuset-styling-active .woocommerce ul.products, | |
| .woocommerce.gullhuset-wc-products-wrapper ul.products, | |
| .woocommerce ul.products.gullhuset-products { |
This file contains hidden or 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
| // Change shipping based on quantity purchased. | |
| // https://easywebdesigntutorials.com/adjust-shipping-price-when-quantity-changes/ | |
| // https://businessbloomer.com/woocommerce-setup-tiered-shipping-rates-order-amount/ | |
| add_filter( 'woocommerce_package_rates', 'bbloomer_woocommerce_tiered_shipping', 10, 2 ); | |
| function bbloomer_woocommerce_tiered_shipping( $rates, $package ) { | |
| $threshold1 = 2; | |
| $threshold2 = 3; | |
| if ( WC()->cart->get_cart_contents_count() < $threshold1 ) { | |
| unset( $rates['flat_rate:6'], $rates['flat_rate:8'] ); | |
| } elseif ( WC()->cart->get_cart_contents_count() < $threshold2 ){ |
This file contains hidden or 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
| // Initial inspiration: https://businessbloomer.com/woocommerce-add-shipping-phone-checkout/ | |
| // My Custom Fields | |
| // Can be added to billing, shipping or order area. For the account page use the word account. | |
| add_filter( 'woocommerce_checkout_fields', 'custom_fields_checkout' ); | |
| function custom_fields_checkout( $fields ) { | |
| $fields['billing']['billing_idrettslag'] = array( | |
| 'label' => 'Hvilken idrettslag/ forening/ klasse?', | |
| 'type' => 'text', | |
| 'required' => true, |
This file contains hidden or 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
| /* --------- Adds custom fields using filters. ------ | |
| The below custom fields shows various types one can use. | |
| It is then displayed in the backend Order Details page and in admin and customer e-mails. | |
| Checkboxes by default result only show the number 1 when clicked. I have added code so that when the a checkbox is clicked it will | |
| show text such as On and Yes. Checkbox is also pre-selected. | |
| Tutorial: https://easywebdesigntutorials.com/woocommerce-modifying-the-checkout-page/ | |
| */ | |
| // Initial inspiration: https://businessbloomer.com/woocommerce-add-shipping-phone-checkout/ | |
| // My Custom Fields |
This file contains hidden or 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
| // https://businessbloomer.com/woocommerce-add-shipping-phone-checkout/ | |
| // Year | |
| add_filter( 'woocommerce_checkout_fields', 'bbloomer_billing_year_checkout' ); | |
| function bbloomer_billing_year_checkout( $fields ) { | |
| $fields['billing']['billing_year'] = array( | |
| 'label' => 'I am over 18', | |
| 'type' => 'checkbox', | |
| 'required' => true, | |
| 'class' => array( 'form-row-wide' ), |
This file contains hidden or 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
| // https://businessbloomer.com/woocommerce-add-shipping-phone-checkout/ | |
| // Year | |
| add_filter( 'woocommerce_checkout_fields', 'bbloomer_billing_year_checkout' ); | |
| function bbloomer_billing_year_checkout( $fields ) { | |
| $fields['billing']['billing_year'] = array( | |
| 'label' => 'I am over 18', | |
| 'type' => 'checkbox', | |
| 'required' => true, | |
| 'class' => array( 'form-row-wide' ), |
This file contains hidden or 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
| /* 1. Adds a custom field. NB. I am using some Norwegian words in the below text. | |
| * 2. Then adds a validate error message if person does not fill out the field. | |
| * 3. Then adds the custom field to the order page. | |
| https://businessbloomer.com/woocommerce-add-custom-checkout-field-php/ | |
| https://businessbloomer.com/woocommerce-add-shipping-phone-checkout/ | |
| https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/#section-6 | |
| */ | |
| add_action( 'woocommerce_before_order_notes', 'my_custom_checkout_field' ); | |
| function my_custom_checkout_field( $checkout ) { |
This file contains hidden or 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
| /** Initial code from: https://gist.github.com/kloon/6495019 | |
| As the code did not fully work I received help from Helga the Viking | |
| with this gist: https://gist.github.com/helgatheviking/ff8792fbb12f5c5367c816b8a46c70ad | |
| * Change the quantity input to select. | |
| * @param array $args Args for the input. | |
| * @param WC_Product|null $product Product. | |
| * @param boolean $echo Whether to return or echo|string. | |
| * @return string | |
| */ |
NewerOlder