Skip to content

Instantly share code, notes, and snippets.

@farik92
farik92 / content-single-product.php
Created June 27, 2023 00:43 — forked from etiennetremel/content-single-product.php
WooCommerce Upsells Upsells as checkbox. When product is deleted from the cart, upsells are also deleted.
<?php
/**
* The template for displaying product content in the single-product.php template
*
* Override this template by copying it to yourtheme/woocommerce/content-single-product.php
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
@farik92
farik92 / woocommerce-overrides.php
Created June 22, 2023 06:41 — forked from BurlesonBrad/woocommerce-overrides.php
Include this in your theme to allow WooCommerce variable products to be displayed in a grid format with each variation having there own quantity and add to cart button, rather then the drop-down options. This should be include in your themes function file.
<?php
/******************************************************************************
* Variation Grid
*
* The following function allow for the theme to display product variations in a grid format.
* This code could be moved to a plugin but is in the theme function file as it used the
* themes grid system.
*
* @reference: http://www.eggplantstudios.ca/woocommerce-product-variation-add-cart-grid/
* ******************************************************************************/
@farik92
farik92 / point-in-polygon.php
Created June 21, 2023 00:15 — forked from vzool/point-in-polygon.php
The point-in-polygon algorithm allows you to check if a point is inside a polygon or outside of it.
<?php
/*
Description: The point-in-polygon algorithm allows you to check if a point is
inside a polygon or outside of it.
Author: Michaël Niessen (2009)
Website: http://AssemblySys.com
If you find this script useful, you can show your
appreciation by getting Michaël a cup of coffee ;)
PayPal: michael.niessen@assemblysys.com
@farik92
farik92 / functions.php
Created June 19, 2023 03:10 — forked from mikejolley/functions.php
WooCommerce - Show quantity inputs for simple products within loops.
<?php
/**
* Code should be placed in your theme functions.php file.
*/
add_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 2 );
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
$html .= woocommerce_quantity_input( array(), $product, false );
@farik92
farik92 / gist:ac33901a7da2107c6531cb3f5738dd60
Created June 17, 2023 22:22 — forked from kloon/gist:4604038
WooCommerce Sale Products shortcode
<?php
add_shortcode( 'sale_products', 'sale_products' );
function sale_products( $atts ){
global $woocommerce_loop, $woocommerce;
extract( shortcode_atts( array(
'per_page' => '12',
'columns' => '4',
'orderby' => 'title',
'order' => 'asc'
@farik92
farik92 / mapwithmarkers.js
Created June 14, 2023 02:19 — forked from ivn-cote/mapwithmarkers.js
maps, yandex, google
/*
using
MapInterface.ready( 'yandex', {
yandex: $('#mapInfoBlock'),
google: $('#map-info_window-container')
} )
var mapCenter = calcMCenter( getShopsStack() )
var mapCallback = function() {
window.regionMap.addHandler( '.shopchoose', ShopChoosed )
}
@farik92
farik92 / view.php
Created June 14, 2023 01:04 — forked from NataliaDe/view.php
yandex map
<script src="http://api-maps.yandex.ru/2.1-dev/?lang=ru-RU&load=package.full" type="text/javascript"></script>
<div class="left">"._GEOGPS.":</div><div class="center">
<script type="text/javascript">
ymaps.ready(init);
function init() {
myMapGeo = new ymaps.Map('YMapsIDgeopoint', {
@farik92
farik92 / wpseo_breadcrumb_links.php
Created June 8, 2023 21:35 — forked from jmcclellan/wpseo_breadcrumb_links.php
Override Yoast SEO Breadcrumb Trail
@farik92
farik92 / yoast_seo_breadcrumb_add_woo_shop.php
Created June 8, 2023 21:34 — forked from amboutwe/yoast_seo_breadcrumb_add_woo_shop.php
Multiple examples of how to customize the Yoast SEO breadcrumbs
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Add shop link to the Yoast SEO breadcrumbs for a WooCommerce shop page.
* Credit: https://wordpress.stackexchange.com/users/8495/rjb
* Last Tested: Apr 20 2017 using Yoast SEO 4.6 on WordPress 4.7.3
*/
add_filter( 'wpseo_breadcrumb_links', 'wpseo_breadcrumb_add_woo_shop_link' );
@farik92
farik92 / yoast_seo_canonical_change_woocom_shop.php
Created June 8, 2023 21:32 — forked from amboutwe/yoast_seo_canonical_change_woocom_shop.php
Code snippets for the Yoast SEO canonical output
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change the canonical link for the shop page
* Credit: Scott Weiss of somethumb.com
* Yoast Doc: https://developer.yoast.com/features/seo-tags/canonical-urls/api/
* Last Tested: Jan 25 2017 using Yoast SEO 6.0 on WordPress 4.9.1
*/
add_filter( 'wpseo_canonical', 'yoast_seo_canonical_change_woocom_shop', 10, 1 );