Skip to content

Instantly share code, notes, and snippets.

Avatar

WooGists woogists

View GitHub Profile
@woogists
woogists / change-checkout-urls-to-product-urls.php
Created Apr 26, 2021
For the Facebook for WooCommerce extension. By default, the link that is shared with Facebook is an “Add to Cart” URL for your product to speed up the checkout process. You may want this to be the product URL for a number of reasons. If so, you can use this code snippet to send the product URL to Facebook instead - https://docs.woocommerce.com/d…
View change-checkout-urls-to-product-urls.php
<?php // only copy this line if needed
/**
* Change checkout URLs to product URLs for Facebook products
*/
function sv_fbw_checkout_url_to_product( $product_data, $id ){
$product_data['checkout_url'] = $product_data['url'];
View woocommerce-usps-letters-and-envelopes.php
/**
* Add letters and envelopes to international services.
*/
add_filter( 'wc_usps_services', function( $services ) {
$services['I_FIRST_CLASS']['services']['13'] = "First Class Mail&#0174; International Letters";
$services['I_FIRST_CLASS']['services']['14'] = "First Class Mail&#0174; International Large Envelope";
return $services;
} );
@woogists
woogists / functions.php
Last active Jul 25, 2019
[WooCommerce Bookings]: Set custom Google client ID and secret
View functions.php
/**
* Update Google client with your own application's cliend ID and secret from the Google Developer's Console.
*/
add_action(
'woocommerce_bookings_update_google_client',
function ( Google_Client $client ) {
$client->setClientId( 'YourClientIDFromGoogleDevelopersConsole' );
$client->setClientSecret( 'YourClientIDFromGoogleDevelopersConsole' );
}
);
View gist:482a79494f6def6b127326af5057b0d6
<?php
add_filter( 'wc_shipment_tracking_get_providers' , 'wc_shipment_tracking_add_custom_provider' );
/**
* wc_shipment_tracking_add_custom_provider
*
* Adds custom provider to shipment tracking
* Change the country name, the provider name, and the URL (it must include the %1$s)
* Add one provider per line
@woogists
woogists / gist:9bd427bdf92e966d7f368355f97e17b2
Created Mar 20, 2019
Bookings REST API Bookings JSON Response
View gist:9bd427bdf92e966d7f368355f97e17b2
[
{
"all_day": true,
"cost": "100",
"customer_id": 1,
"date_created": 1551471271,
"date_modified": 1551593795,
"end": 1551571199,
"google_calendar_event_id": "uhd8bir3raajo4tco365foii1o",
"order_id": 154167,
@woogists
woogists / gist:04acb250c38f042911a97a46bd3815db
Last active Mar 20, 2019
Bookings REST API Products JSON Response
View gist:04acb250c38f042911a97a46bd3815db
[
{
"id": 171578,
"name": "Candy Land",
"slug": "candy-land",
"permalink": "https://yoursite.test/product/candy-land/",
"date_created": "2019-03-19T10:54:48",
"date_created_gmt": "2019-03-19T17:54:48",
"date_modified": "2019-03-19T15:37:38",
"date_modified_gmt": "2019-03-19T22:37:38",
@woogists
woogists / gist:75b8b462855fe8c981d543b028815bd7
Created Mar 19, 2019
Bookings REST API Resources JSON Response
View gist:75b8b462855fe8c981d543b028815bd7
[
{
"id": 145546,
"availability": [],
"base_cost": 0,
"block_cost": 0,
"name": "The Vault",
"parent_id": 0,
"qty": "5",
"sort_order": 0,
@woogists
woogists / gist:cb71b7208cd870a08e6beba773b42988
Last active Mar 19, 2019
Bookings REST API Categories JSON Response
View gist:cb71b7208cd870a08e6beba773b42988
[
{
"id": 484,
"name": "Accessories",
"slug": "accessories",
"parent": 0,
"description": "",
"display": "default",
"image": null,
"menu_order": 0,
@woogists
woogists / gist:bd4065d14cb74bb76db7fdbdbdcc77c9
Last active Mar 19, 2019
Bookings REST API Slots JSON Response
View gist:bd4065d14cb74bb76db7fdbdbdcc77c9
{
"records": [
{
"date": "2019-03-19T00:00:00-0700",
"duration": 1,
"duration_unit": "day",
"booked": 0,
"available": 1,
"resources": {
"0": 1
@woogists
woogists / storefront-logo-size-adjust-example.css
Created Oct 26, 2018
Adjust the dimensions of the header logo in the Storefront theme.
View storefront-logo-size-adjust-example.css
@media screen and (min-width: 768px) {
.woocommerce-active .site-header .site-branding img {
max-width: 40%; /* Adjust this percentage up or down to make the logo larger or smaller. */
}
}