class-wc-product-variable-data-store-interface.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /**
  3. * Product Variable Data Store Interface
  4. *
  5. * @version 3.0.0
  6. * @package WooCommerce/Interface
  7. */
  8. if ( ! defined( 'ABSPATH' ) ) {
  9. exit;
  10. }
  11. /**
  12. * WC Product Variable Data Store Interface
  13. *
  14. * Functions that must be defined by product variable store classes.
  15. *
  16. * @version 3.0.0
  17. */
  18. interface WC_Product_Variable_Data_Store_Interface {
  19. /**
  20. * Does a child have a weight set?
  21. *
  22. * @param WC_Product $product Product object.
  23. * @return boolean
  24. */
  25. public function child_has_weight( $product );
  26. /**
  27. * Does a child have dimensions set?
  28. *
  29. * @param WC_Product $product Product object.
  30. * @return boolean
  31. */
  32. public function child_has_dimensions( $product );
  33. /**
  34. * Is a child in stock?
  35. *
  36. * @param WC_Product $product Product object.
  37. * @return boolean
  38. */
  39. public function child_is_in_stock( $product );
  40. /**
  41. * Syncs all variation names if the parent name is changed.
  42. *
  43. * @param WC_Product $product Product object.
  44. * @param string $previous_name Previous name.
  45. * @param string $new_name New name.
  46. */
  47. public function sync_variation_names( &$product, $previous_name = '', $new_name = '' );
  48. /**
  49. * Stock managed at the parent level - update children being managed by this product.
  50. * This sync function syncs downwards (from parent to child) when the variable product is saved.
  51. *
  52. * @param WC_Product $product Product object.
  53. */
  54. public function sync_managed_variation_stock_status( &$product );
  55. /**
  56. * Sync variable product prices with children.
  57. *
  58. * @param WC_Product|int $product Product object or ID.
  59. */
  60. public function sync_price( &$product );
  61. /**
  62. * Delete variations of a product.
  63. *
  64. * @param int $product_id Product ID.
  65. * @param bool $force_delete False to trash.
  66. */
  67. public function delete_variations( $product_id, $force_delete = false );
  68. /**
  69. * Untrash variations.
  70. *
  71. * @param int $product_id Product ID.
  72. */
  73. public function untrash_variations( $product_id );
  74. }