Skip to content

Instantly share code, notes, and snippets.

View luiseduardobraschi's full-sized avatar
🤓
Updating knowledgebase...

Luis Braschi luiseduardobraschi

🤓
Updating knowledgebase...
View GitHub Profile
@luiseduardobraschi
luiseduardobraschi / README.md
Created May 8, 2025 01:03
List WooCommerce categories in "key value" format from Rest API

You will need JQ to format the output.

@luiseduardobraschi
luiseduardobraschi / Doughut.php
Created April 27, 2025 20:41
How to remove the X and Y axes in Filament doughnut charts
<?php
protected function getOptions(): array | RawJs | null
{
return [
'scales' => [
'x' => ['display' => false,],
'y' => ['display' => false,],
],
];
@luiseduardobraschi
luiseduardobraschi / functions.php
Created March 28, 2024 06:19
Compatibilidade Dokan e Simulador de Frete para WooCommerce (Luiz Bills)
<?php
add_filter( 'wc_shipping_simulator_package_data', function( $package ){
if( $product_id = $_GET['product'] ?? $_POST['product_id'] ?? false ){
$package['seller_id'] = get_post_field( 'post_author', $product_id );
}
return $package;
@luiseduardobraschi
luiseduardobraschi / dynamic.php
Created March 26, 2024 21:59
Dynamic routing in Laravel
<?php
Route::match(
['get', 'post'],
'{controller}/{action?}/{params?}',
function ($controller, $action = 'index', $params = '') {
$params = explode('/', $params);
$methodParams = [];
foreach ($params as $key => $param) {
@luiseduardobraschi
luiseduardobraschi / class-wc-pagarme-api.php
Created March 15, 2024 04:43
Atualização de status plugin Pagar.me - Cláudio Sanches
<?php
/**
* Pagar.me API
*
* @package WooCommerce_Pagarme/API
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@luiseduardobraschi
luiseduardobraschi / functions.php
Created March 15, 2024 04:39
[Fórum WP] Validação fingerprint postback
<?php
if( !class_exists( 'WCPagarmePixPayment\Pagarme\PagarmeApiV4' ) ){
return;
}
use WCPagarmePixPayment\Pagarme\PagarmeApiV4;
class ArtiPagarmeApi extends PagarmeApiV4 {
@luiseduardobraschi
luiseduardobraschi / functions.php
Created May 28, 2023 00:59
[WC Correios] Corrige o valor declarado para o valor atual.
<?php
// Valor declarado.
add_filter( 'woocommerce_correios_shipping_args', function( $args ){
if( 24 >= $args['nVlValorDeclarado'] ){
$args['nVlValorDeclarado'] = 0;
}
return $args;
@luiseduardobraschi
luiseduardobraschi / functions.php
Last active May 28, 2023 00:57
[Fórum WP] PIX Pagar.me não copia código.
<?php
add_action( 'wp_enqueue_scripts', function(){
$is_pix_payment_page = function(){
global $wp;
//Page is view order or order received?
if( !isset($wp->query_vars['order-received']) && !isset($wp->query_vars['view-order']) )
return;
@luiseduardobraschi
luiseduardobraschi / .htaccess
Last active March 11, 2023 09:58
.htaccess - Load image from WooCommerce (WordPress, actually) production site if image not found in test env.
# You must place it above the "# BEGIN WordPress" comment.
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$
RewriteCond %{REQUEST_FILENAME} !-f
# Just change the URL to your liking.
RewriteRule ^(.*)$ https://www.production-site.com/wp-content/uploads/$1 [L]
</IfModule>
@luiseduardobraschi
luiseduardobraschi / functions.php
Created August 30, 2021 21:13
[WCBR] Resposta post WooCommerce Brasil - 4342857705782162
<?php
function wcbr_create_lottery_numbers( $order_id ){
$order = wc_get_order( $order_id );
$items = $order->get_items();
$lucky_product_id = 28;
foreach( $items as $item_id => $item ) {