Skip to content

Instantly share code, notes, and snippets.

@fernandoacosta
fernandoacosta / functions.php
Last active January 29, 2020 17:04 — forked from SiR-DanieL/functions.php
Exibir produtos recentes quando nenhum produto for encontrado na busca
add_action( 'woocommerce_no_products_found', 'show_products_on_no_products_found', 20 );
function show_products_on_no_products_found() {
echo '<h2>' . __( 'Mas você pode gostar disso...', 'domain' ) . '</h2>';
echo do_shortcode( '[recent_products per_page="4"]' );
}
@Frisoni
Frisoni / style.css
Last active April 3, 2020 13:25
Flatsome testimonial customization
/* Flatsome testimonial customization */
.testimonial-box {
margin-bottom: 50px;
border-radius: 7px;
-webkit-box-shadow: 0px 0px 10px 3px rgba(225,225,225,0.75);
-moz-box-shadow: 0px 0px 10px 3px rgba(225,225,225,0.75);
box-shadow: 0px 0px 10px 3px rgba(225,225,225,0.75);
}
.testimonial-box .testimonial-image {
top: -50px;
@callmeloureiro
callmeloureiro / comoSerChatoNoWhatsapp.js
Last active January 15, 2024 20:44
Como fazer alguém te responder no whatsapp
/*
Hoje iremos MUDAR a vida da pessoa que não te responde no whatsappp...
Que tal enviar mensagens pra ela até obter uma resposta?!
Sensacional não acha?! Mas, somos devs, correto?! Então vamos automatizar esse paranauê!
Para utilizar:
- Abra o web.whatsapp.com;
- Selecione a conversa que você quer;
- Abra o console e cole o código que está no gist;
@jessepearson
jessepearson / adding_new_webhook_topics.php
Last active May 12, 2024 19:33
How to add a new custom Webhook topic in WooCommerce, with example of order filtering.
<?php // do not copy this line
/**
* add_new_topic_hooks will add a new webhook topic hook.
* @param array $topic_hooks Esxisting topic hooks.
*/
function add_new_topic_hooks( $topic_hooks ) {
// Array that has the topic as resource.event with arrays of actions that call that topic.
@davidwilliamdacosta
davidwilliamdacosta / exibir-produtos-sem-estoque-final-pagina.php
Created December 7, 2016 13:10
Exibir produtos sem estoque final da pagina Woocommerce
<?php
/**
* Order product collections by stock status, instock products first.
*/
class iWC_Orderby_Stock_Status
{
public function __construct()
{
@jh00nbr
jh00nbr / cpf_consulta_api_sus.py
Last active May 17, 2023 17:36
Script simples para consulta de dados na base dados nacional do SUS utilizando o CPF.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests,json,sys
# Script simples para consulta de dados na base dados nacional do SUS utilizando o CPF.
# Jhonathan Davi A.K.A jh00nbr / Insightl4b lab.insightsecurity.com.br
# jh00nbr: http://jhonathandavi.com.br
# Blog: lab.insightsecurity.com.br
# Github: github.com/jh00nbr
# Twitter @jh00nbr
@bekarice
bekarice / wc-custom-order-action-sample.php
Created October 24, 2016 06:55
Add a WooCommerce custom order action
<?php // only copy if needed
/**
* Add a custom action to order actions select box on edit order page
* Only added for paid orders that haven't fired this action yet
*
* @param array $actions order actions array to display
* @return array - updated actions
*/
function sv_wc_add_order_meta_box_action( $actions ) {
@corsonr
corsonr / functions.php
Created September 28, 2016 08:33
Display WooCommerce product variations dropdown select on the shop page
<?php
// Display variations dropdowns on shop page for variable products
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' );
function woo_display_variation_dropdown_on_shop_page() {
global $product;
if( $product->is_type( 'variable' )) {
@bekarice
bekarice / wc-prevent-checkout-for-cart-with-specific-category.php
Last active June 29, 2023 20:32
Prevents checkout if the WooCommerce cart only contains items from a specific category
<?php // only copy this line if needed
/**
* Renders a notice and prevents checkout if the cart
* only contains products in a specific category
*/
function sv_wc_prevent_checkout_for_category() {
// set the slug of the category for which we disallow checkout
$category = 'clothing';
@stevenkellow
stevenkellow / woocommerce-order-referrer.php
Created June 23, 2016 08:42
Add Referrer to WooCommerce order
<?php
// Set cookie for new users
add_action( 'init', 'set_newuser_cookie'); // Run when WordPress loads
function set_newuser_cookie() {
$cookie_value = $_SERVER["HTTP_REFERER"]; // Get URL the user came to your site for
if ( !is_admin() && !isset($_COOKIE['origin'])) { // If not an admin or if cookie doesn't exist already
setcookie( 'origin', $cookie_value, time()+3600*24*30, COOKIEPATH, COOKIE_DOMAIN, false); // Set cookie for 30 days
}