Skip to content

Instantly share code, notes, and snippets.

@iworks
Created April 8, 2024 10:23
Show Gist options
  • Save iworks/f57af41affd6243ab7b1b1335968f48f to your computer and use it in GitHub Desktop.
Save iworks/f57af41affd6243ab7b1b1335968f48f to your computer and use it in GitHub Desktop.
class/paczkomaty-inpost.php - fix
50c50
< add_action( 'save_post', [ $this, 'save_product_data' ], 1, 3 );
---
> add_action( 'save_post', [ $this, 'save_product_data' ], 1 );
875,877c875,878
< public function save_product_data( $post_id, $post, $update ) {
< if ( isset( $post ) && 'product' === $post->post_type && $post_id ) {
< $product = wc_get_product( $post_id );
---
> public function save_product_data() {
> global $post;
> if ( isset( $post ) && 'product' === $post->post_type && $post->ID ) {
> $product = wc_get_product( $post->ID );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment