Skip to content

Instantly share code, notes, and snippets.

View woogists's full-sized avatar

WooGists woogists

View GitHub Profile
@woogists
woogists / wc-output-content-itself.php
Created March 9, 2018 16:07
[WooCommerce 360 Image] There is also a filter for the output of the content itself.
add_filter( 'wc360_image_output', 'wcs_360_image_output' );
function wcs_360_image_output( $content ) {
return $content;
}
@woogists
woogists / wc-Shortcode-Content-Output.php
Created March 9, 2018 16:08
[WooCommerce 360 Image] Filter the content of the shortcode
add_filter( 'wc360_shortcode_image_output', 'wcs_360_shortcode_image_output' );
function wcs_360_shortcode_image_output( $content ) {
return $content;
}
@woogists
woogists / wc-order-barcodes-display-barcode.php
Last active September 30, 2022 15:33
[WooCommerce Order Barcodes] Snippet To Display Barcodes Anywhere
/*
* Snippet to display Order Barcodes on your site.
* Just copy the PHP Snippet to your template, and it will be displayed over there.
*/
echo WC_Order_Barcodes()->display_barcode($order_id);
@woogists
woogists / wc-bookings-styles.css
Last active June 21, 2023 17:21
[WooCommerce Bookings] Calendar CSS Style Elements
/*
Modify the color styles of the WooCommerce Bookings datepicker calendar.
Add any/all of these styles to your theme's custom CSS, but be sure to change
the color hex codes to your choice. They're all black here.
*/
/* Month header background color */
#wc-bookings-booking-form .wc-bookings-date-picker .ui-datepicker-header {
background-color: #000000;
}
@woogists
woogists / wc-instagram-image-size.php
Created March 9, 2018 16:13
[WooCommerce Instagram] If you want to change this to thumbnails or another image size, add this code to the 'custom functions' area of your functions.php file:
add_filter( 'woocommerce_instagram_image_size', 'change_wci_size_used' );
function change_wci_size_used() {
return 'thumbnail';
}
@woogists
woogists / wc-bookings-auto-create-follow-ups.php
Created March 9, 2018 16:16
[WooCommerce Bookings] Use case: Creating a one-week follow-up
/**
* Code goes in theme functions.php
*
* In this example we're creating a booking 1 week after a booking is paid for.
* This does not create another order or payment, just an additional booking.
* $exact is false meaning if our slot is taken, the next available slot will be used.
* @link https://docs.woocommerce.com/document/creating-bookings-programatically/
*/
function auto_create_followup_booking( $booking_id ) {
@woogists
woogists / amazon-payments-stretched-image-fix.css
Created March 9, 2018 16:17
[Amazon Payments] Fix stretched or distorted amazon widgets on a mobile device.
#amazon_addressbook_widget div, #amazon_wallet_widget div {
min-width: 260px !important;
}
@woogists
woogists / wc-bookings-bookings_calendar_default_to_first_available.php
Created March 9, 2018 16:17
[WooCommerce Bookings] Make calendar default to first available booking
/**
* Will make the Bookings calender default to the month with the first available booking.
*/
add_filter( 'wc_bookings_calendar_default_to_current_date', '__return_false' );
@woogists
woogists / wc-bookings-summary-list-date
Created March 9, 2018 16:19
[WooCommerce Bookings] Modify the date in a booking’s summary
/**
* wc_bookings_summary_list_date is used to filter a booking's summary date.
* This example removes the end date for a multi-day booking.
*
* @param string $booking_date The formatted date that is displayed by default.
* @param int $booking_start Timestamp for the booking start time/date.
* @param int $booking_end Timestamp for the booking end time/date.
* @return string The modified date string.
*/
function modify_summary_date_20170821( $booking_date, $booking_start, $booking_end ) {
@woogists
woogists / wc-returns-warranty-add-custom-statuses.php
Last active October 1, 2018 18:55
[Returns and Warranty Requests] Add custom statuses
function warranty_add_custom_statuses() {
if (! function_exists('warranty_get_statuses')) return;
// Statuses to add
$statuses = array('Custom Status 1', 'Custom Status 2');
foreach ( $statuses as $status ) {
$term = get_term_by( 'name', $status, 'shop_warranty_status' );
if (! $term ) {